comparison default/node_modules/shoestring/src/dom/prevAll.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", "dom/prev" ], function(){
3 //>>excludeEnd("exclude");
4
5 /**
6 * Returns a `shoestring` object with the set of *all* siblings before each element in the original set.
7 *
8 * @return shoestring
9 * @this shoestring
10 */
11 shoestring.fn.prevAll = function(){
12 //>>includeStart("development", pragmas.development);
13 if( arguments.length > 0 ){
14 shoestring.error( 'prevall-selector' );
15 }
16 //>>includeEnd("development");
17
18 var result = [];
19
20 this.each(function() {
21 var $previous = shoestring( this ).prev();
22
23 while( $previous.length ){
24 result.push( $previous[0] );
25 $previous = $previous.prev();
26 }
27 });
28
29 return shoestring( result );
30 };
31
32 //>>excludeStart("exclude", pragmas.exclude);
33 });
34 //>>excludeEnd("exclude");