I agree then, it is inconsistent. Once I get the bug tracker up, this should go in.
--John On 5/9/07, Arrix <[EMAIL PROTECTED]> wrote:
The .removeClass() behavior is good. But I don't think .removeClass("") should remove every class. Though it doesn't make sense to write .removeClass(""), sometimes the parameter passed to .removeClass is a variable $('#someId').removeClass(classToRemove); classToRemove may be set to "" by previous code and that will destroy the page styles completely. One way to avoid the issue is to check against accidental "" $('#someId').removeClass(classToRemove || " "); On 5/10/07, John Resig <[EMAIL PROTECTED] > wrote: > > No, that's expected. removeClass() was re-worked such that > .removeClass("one") would remove one class, .removeClass("one two") > would remove two classes, and .removeClass() would remove all classes. > This is very similar to how .unbind() works (if you call it with no > arguments, it removes all bound events). > > Although, I'm not sure if you're differentiating between > .removeClass("") and .removeClass(). If that's the case, then it is > possible that the first one should, in fact, remove no classes. (Since > the method is being called with an argument.) > > --John > > On 5/9/07, Arrix <[EMAIL PROTECTED]> wrote: > > $('#id').removeClass(''); > > In the svn edge version > > Calling removeClass with an empty string as className will remove all > > classes. It's expected to remove nothing. > > The trac is not back yet so I'm reporting bug here. > > > > -- > > Arrix > -- Arrix