]> source.dussan.org Git - jquery.git/commitdiff
Simplify jQuery#wrap
authorOleg <markelog@gmail.com>
Wed, 19 Dec 2012 18:42:07 +0000 (22:42 +0400)
committerOleg <markelog@gmail.com>
Sun, 23 Dec 2012 23:03:28 +0000 (03:03 +0400)
src/manipulation.js

index 9a60d1089e6cba5c1ffda5bc9e766f08946a3e2f..e0edab197f5064e30ba974b47b5cd7272056eb77 100644 (file)
@@ -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 = "";
                        }
                }