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 = "";
}
}