comparison default/node_modules/shoestring/src/dom/parent.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 set of first parents for each element in the current set.
7 *
8 * @return shoestring
9 * @this shoestring
10 */
11 shoestring.fn.parent = function(){
12 var ret = [],
13 parent;
14
15 this.each(function(){
16 // no parent node, assume top level
17 // jQuery parent: return the document object for <html> or the parent node if it exists
18 parent = (this === doc.documentElement ? doc : this.parentNode);
19
20 // if there is a parent and it's not a document fragment
21 if( parent && parent.nodeType !== 11 ){
22 ret.push( parent );
23 }
24 });
25
26 return shoestring(ret);
27 };
28
29 //>>excludeStart("exclude", pragmas.exclude);
30 });
31 //>>excludeEnd("exclude");