From 94b0bf5f2b7a4003196a679649567a13d0f13ad0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Zaefferer?= Date: Fri, 22 Sep 2006 21:07:04 +0000 Subject: [PATCH] Changed implementation of removeClass: No more regex, tested and working in FF1.5, IE6 and Opera9 (tests added)- see http://jquery.com/discuss/2006-September/012088/ --- src/jquery/jquery.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index a0d877517..b7715be35 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1373,9 +1373,22 @@ jQuery.extend({ o.className += ( o.className ? " " : "" ) + c; }, remove: function(o,c){ + /* o.className = !c ? "" : o.className.replace( - new RegExp("(^|\\s*\\b[^-])"+c+"($|\\b(?=[^-]))", "g"), ""); + new RegExp("(^|\\s*\\b[^-])"+c+"($|\\b(?=[^-]))", "g"), "");*/ + if( !c ) { + o.className = ""; + } else { + var classes = o.className.split(" "); + for(var i=0; i