[jQuery] Re: [bug]removeClass('') removes all classes
The bug tracker is back up again - feel free to add this as a bug! --John On 5/9/07, John Resig [EMAIL PROTECTED] wrote: 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
[jQuery] Re: [bug]removeClass('') removes all classes
Glad to see the trac up and running:-) Ticket created herehttp://dev.jquery.com/ticket/1167. On 5/11/07, John Resig [EMAIL PROTECTED] wrote: The bug tracker is back up again - feel free to add this as a bug! --John On 5/9/07, John Resig [EMAIL PROTECTED] wrote: 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 -- Arrix
[jQuery] Re: [bug]removeClass('') removes all classes
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
[jQuery] Re: [bug]removeClass('') removes all classes
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
[jQuery] Re: [bug]removeClass('') removes all classes
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