aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 3a4f9a688..196794f83 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -160,10 +160,12 @@ jQuery.fn.extend({
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
- i = 0;
+ elems = selector ? jQuery.filter( selector, this ) : this,
+ i = elems.length;
+
+ while ( i-- ) {
+ elem = elems[ i ];
- for ( ; (elem = this[i]) != null; i++ ) {
- if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
}
@@ -175,7 +177,6 @@ jQuery.fn.extend({
elem.parentNode.removeChild( elem );
}
}
- }
return this;
},