X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fmanipulation.js;h=1b8066f00fdee1d755def0b84325c5039a310ee4;hb=7a67f8897d3c2ed97254f0fdb969be14e77962d1;hp=583d445be23296879e6e03de950a1c820d819c57;hpb=29ff710c9b02dee2c407b408ea88489b3cef688e;p=jquery.git diff --git a/src/manipulation.js b/src/manipulation.js index 583d445..1b8066f 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -37,7 +37,7 @@ jQuery.fn.extend({ jQuery(this).wrapAll( html.apply(this, arguments) ); }); } - + if ( this[0] ) { // The elements to wrap the target around var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(); @@ -183,7 +183,7 @@ jQuery.fn.extend({ cached = true; } } - + if ( !fragment ) { fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(); scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ); @@ -249,18 +249,21 @@ jQuery.each({ }); jQuery.each({ - remove: function( selector ) { + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { if ( !selector || jQuery.multiFilter( selector, [ this ] ).length ) { - if ( this.nodeType === 1 ) { + if ( !keepData && this.nodeType === 1 ) { cleanData( jQuery("*", this).add(this) ); } - if ( this.parentNode ) { - this.parentNode.removeChild( this ); - } + this.parentNode && this.parentNode.removeChild( this ); } }, + detach: function( selector ) { + jQuery( this ).remove( selector, true ) + }, + empty: function() { // Remove element nodes and prevent memory leaks if ( this.nodeType === 1 ) {