comparison default/node_modules/shoestring/src/dom/siblings.js @ 0:1d038bc9b3d2 default tip

Up:default
author Liny <dev@neowd.com>
date Sat, 31 May 2025 09:21:51 +0800
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1d038bc9b3d2
1 //>>excludeStart("exclude", pragmas.exclude);
2 define([ "shoestring" ], function(){
3 //>>excludeEnd("exclude");
4
5 /**
6 * Get all of the sibling elements for each element in the current set.
7 *
8 * @return shoestring
9 * @this shoestring
10 */
11 shoestring.fn.siblings = function(){
12 //>>includeStart("development", pragmas.development);
13 if( arguments.length > 0 ) {
14 shoestring.error( 'siblings-selector' );
15 }
16 //>>includeEnd("development");
17
18 if( !this.length ) {
19 return shoestring( [] );
20 }
21
22 var sibs = [], el = this[ 0 ].parentNode.firstChild;
23
24 do {
25 if( el.nodeType === 1 && el !== this[ 0 ] ) {
26 sibs.push( el );
27 }
28
29 el = el.nextSibling;
30 } while( el );
31
32 return shoestring( sibs );
33 };
34
35 //>>excludeStart("exclude", pragmas.exclude);
36 });
37 //>>excludeEnd("exclude");