Mercurial > nebulaweb3
comparison default/node_modules/shoestring/src/dom/get.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 * Returns the raw DOM node at the passed index. | |
7 * | |
8 * @param {integer} index The index of the element to wrap and return. | |
9 * @return {HTMLElement|undefined|array} | |
10 * @this shoestring | |
11 */ | |
12 shoestring.fn.get = function( index ){ | |
13 | |
14 // return an array of elements if index is undefined | |
15 if( index === undefined ){ | |
16 var elements = []; | |
17 | |
18 for( var i = 0; i < this.length; i++ ){ | |
19 elements.push( this[ i ] ); | |
20 } | |
21 | |
22 return elements; | |
23 } else { | |
24 return this[ index ]; | |
25 } | |
26 }; | |
27 | |
28 //>>excludeStart("exclude", pragmas.exclude); | |
29 }); | |
30 //>>excludeEnd("exclude"); |