From cd297dd9ebb7559fc6f0d7ca43bc13dc07e36b9e Mon Sep 17 00:00:00 2001 From: John Resig Date: Mon, 10 Apr 2006 06:09:16 +0000 Subject: [PATCH] Extra spaces weren't being removed with removeClass - but I haven't found a good workaround yet. --- jquery/jquery.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jquery/jquery.js b/jquery/jquery.js index 668a592d..07fcdffe 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'), ''); });