Skip to content

Commit 726b536

Browse files
author
@soyjavi
committed
New method: siblings()
1 parent a9e1f09 commit 726b536

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

source/quo.query.coffee

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ do ($$ = Quo) ->
4444
elements = @map -> Array::slice.call @children
4545
_filtered elements, selector
4646

47+
48+
###
49+
Get the siblings of each element in the current instance
50+
@method siblings
51+
@param {string} A string containing a selector expression to match elements against.
52+
###
53+
$$.fn.siblings = (selector) ->
54+
elements = @map((index, element) ->
55+
Array::slice.call(element.parentNode.children).filter (child) ->
56+
child isnt element
57+
)
58+
_filtered elements, selector
59+
60+
4761
###
4862
Retrieve the DOM elements matched by the QuoJS object.
4963
@method get

0 commit comments

Comments
 (0)