From: John Resig Date: Mon, 10 Apr 2006 06:09:16 +0000 (+0000) Subject: Extra spaces weren't being removed with removeClass - but I haven't found a good... X-Git-Url: http://git.asbjorn.biz/?a=commitdiff_plain;h=cd297dd9ebb7559fc6f0d7ca43bc13dc07e36b9e;p=jquery.git Extra spaces weren't being removed with removeClass - but I haven't found a good workaround yet. --- diff --git a/jquery/jquery.js b/jquery/jquery.js index 668a592..07fcdff 100644 --- a/jquery/jquery.js +++ b/jquery/jquery.js @@ -106,7 +106,9 @@ function $(a,c) { }, removeClass: function(c) { return this.each(function(){ - this.className = c == null ? '' : + if ( c == null ) + this.className = ''; + else this.className.replace( new RegExp('(^|\\s*\\b[^-])'+c+'($|\\b(?=[^-]))', 'g'), ''); });