/bower_components/jquery/src/wrap.js |
@@ -1,4 +1,4 @@ |
define( [ |
define([ |
"./core", |
"./core/init", |
"./manipulation", // clone |
@@ -5,16 +5,17 @@ |
"./traversing" // parent, contents |
], function( jQuery ) { |
|
"use strict"; |
|
jQuery.fn.extend( { |
jQuery.fn.extend({ |
wrapAll: function( html ) { |
var wrap; |
|
if ( jQuery.isFunction( html ) ) { |
return this.each(function( i ) { |
jQuery( this ).wrapAll( html.call(this, i) ); |
}); |
} |
|
if ( this[ 0 ] ) { |
if ( jQuery.isFunction( html ) ) { |
html = html.call( this[ 0 ] ); |
} |
|
// The elements to wrap the target around |
wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); |
@@ -23,7 +24,7 @@ |
wrap.insertBefore( this[ 0 ] ); |
} |
|
wrap.map( function() { |
wrap.map(function() { |
var elem = this; |
|
while ( elem.firstElementChild ) { |
@@ -31,7 +32,7 @@ |
} |
|
return elem; |
} ).append( this ); |
}).append( this ); |
} |
|
return this; |
@@ -39,12 +40,12 @@ |
|
wrapInner: function( html ) { |
if ( jQuery.isFunction( html ) ) { |
return this.each( function( i ) { |
jQuery( this ).wrapInner( html.call( this, i ) ); |
} ); |
return this.each(function( i ) { |
jQuery( this ).wrapInner( html.call(this, i) ); |
}); |
} |
|
return this.each( function() { |
return this.each(function() { |
var self = jQuery( this ), |
contents = self.contents(); |
|
@@ -54,24 +55,25 @@ |
} else { |
self.append( html ); |
} |
} ); |
}); |
}, |
|
wrap: function( html ) { |
var isFunction = jQuery.isFunction( html ); |
|
return this.each( function( i ) { |
jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); |
} ); |
return this.each(function( i ) { |
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); |
}); |
}, |
|
unwrap: function( selector ) { |
this.parent( selector ).not( "body" ).each( function() { |
jQuery( this ).replaceWith( this.childNodes ); |
} ); |
return this; |
unwrap: function() { |
return this.parent().each(function() { |
if ( !jQuery.nodeName( this, "body" ) ) { |
jQuery( this ).replaceWith( this.childNodes ); |
} |
}).end(); |
} |
} ); |
}); |
|
return jQuery; |
} ); |
}); |