0
|
1 //>>excludeStart("exclude", pragmas.exclude);
|
|
2 define([ "shoestring" ], function(){
|
|
3 //>>excludeEnd("exclude");
|
|
4
|
|
5 /**
|
|
6 * Insert an element or HTML string before each element in the current set.
|
|
7 *
|
|
8 * @param {string|HTMLElement} fragment The HTML or HTMLElement to insert.
|
|
9 * @return shoestring
|
|
10 * @this shoestring
|
|
11 */
|
|
12 shoestring.fn.before = function( fragment ){
|
|
13 if( typeof( fragment ) === "string" || fragment.nodeType !== undefined ){
|
|
14 fragment = shoestring( fragment );
|
|
15 }
|
|
16
|
|
17 return this.each(function( i ){
|
|
18 for( var j = 0, jl = fragment.length; j < jl; j++ ){
|
|
19 this.parentNode.insertBefore( i > 0 ? fragment[ j ].cloneNode( true ) : fragment[ j ], this );
|
|
20 }
|
|
21 });
|
|
22 };
|
|
23
|
|
24 //>>excludeStart("exclude", pragmas.exclude);
|
|
25 });
|
|
26 //>>excludeEnd("exclude");
|