diff options
Diffstat (limited to 'libs/bower_components/jquery/src/wrap.js')
-rw-r--r-- | libs/bower_components/jquery/src/wrap.js | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/libs/bower_components/jquery/src/wrap.js b/libs/bower_components/jquery/src/wrap.js index a3c35d9f24..780a486cb4 100644 --- a/libs/bower_components/jquery/src/wrap.js +++ b/libs/bower_components/jquery/src/wrap.js @@ -1,26 +1,28 @@ -define([ +define( [ "./core", "./core/init", + "./manipulation", // clone "./traversing" // parent, contents ], function( jQuery ) { -jQuery.fn.extend({ +jQuery.fn.extend( { wrapAll: function( html ) { if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); + return this.each( function( i ) { + jQuery( this ).wrapAll( html.call( this, i ) ); + } ); } - if ( this[0] ) { + if ( this[ 0 ] ) { + // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); + if ( this[ 0 ].parentNode ) { + wrap.insertBefore( this[ 0 ] ); } - wrap.map(function() { + wrap.map( function() { var elem = this; while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { @@ -28,7 +30,7 @@ jQuery.fn.extend({ } return elem; - }).append( this ); + } ).append( this ); } return this; @@ -36,12 +38,12 @@ jQuery.fn.extend({ 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(); @@ -51,25 +53,25 @@ jQuery.fn.extend({ } 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() { - return this.parent().each(function() { + return this.parent().each( function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } - }).end(); + } ).end(); } -}); +} ); return jQuery; -}); +} ); |