From: Oleg Date: Wed, 19 Dec 2012 18:42:07 +0000 (+0400) Subject: Simplify jQuery#wrap X-Git-Tag: 2.0.0b1~59^2~44 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8c4b9f082bee05218f7e218b5a0db12e5e333ef4;p=jquery.git Simplify jQuery#wrap --- diff --git a/src/manipulation.js b/src/manipulation.js index 9a60d1089..e0edab197 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -156,15 +156,14 @@ jQuery.fn.extend({ var elem, i = 0; - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks + for ( ; ( elem = this[ i ] ) != null; i++ ) { if ( elem.nodeType === 1 ) { + + // Remove element nodes and prevent memory leaks jQuery.cleanData( getAll( elem, false ) ); - } - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); + // Remove any remaining nodes + elem.textContent = ""; } }