4 "./manipulation", // clone
5 "./traversing" // parent, contents
6 ], function( jQuery ) {
9 wrapAll: function( html ) {
12 if ( jQuery.isFunction( html ) ) {
13 return this.each(function( i ) {
14 jQuery( this ).wrapAll( html.call(this, i) );
20 // The elements to wrap the target around
21 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
23 if ( this[ 0 ].parentNode ) {
24 wrap.insertBefore( this[ 0 ] );
30 while ( elem.firstElementChild ) {
31 elem = elem.firstElementChild;
41 wrapInner: function( html ) {
42 if ( jQuery.isFunction( html ) ) {
43 return this.each(function( i ) {
44 jQuery( this ).wrapInner( html.call(this, i) );
48 return this.each(function() {
49 var self = jQuery( this ),
50 contents = self.contents();
52 if ( contents.length ) {
53 contents.wrapAll( html );
61 wrap: function( html ) {
62 var isFunction = jQuery.isFunction( html );
64 return this.each(function( i ) {
65 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
70 return this.parent().each(function() {
71 if ( !jQuery.nodeName( this, "body" ) ) {
72 jQuery( this ).replaceWith( this.childNodes );