From 62303ad5efa11f0524dde236c91e8cb33ca87b3e Mon Sep 17 00:00:00 2001 From: John Resig Date: Wed, 10 Jan 2007 16:13:48 +0000 Subject: [PATCH] .remove("...") removed too much. --- src/jquery/jquery.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 09005a1..4543b72 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1232,13 +1232,15 @@ jQuery.extend({ elem.className += ( elem.className ? " " : "" ) + cur; }); }, + // internal only, use removeClass("class") remove: function( elem, c ){ - elem.className = c ? - jQuery.grep( elem.className.split(/\s+/), function(cur){ - return !jQuery.className.has( c, cur ); - }).join(' ') : ""; + elem.className = c ? + jQuery.grep( elem.className.split(/\s+/), function(cur){ + return !jQuery.className.has( c, cur ); + }).join(' ') : ""; }, + // internal only, use is(".class") has: function( t, c ) { t = t.className || t; @@ -2032,7 +2034,7 @@ jQuery.each( { jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c); }, remove: function(a){ - if ( !a || jQuery.filter( a, [this] ).r ) + if ( !a || jQuery.filter( a, [this] ).r.length ) this.parentNode.removeChild( this ); }, empty: function() { -- 1.7.10.4