Skip to main content

Bug Tracker

Side navigation

#12411 closed feature (fixed)

Opened August 28, 2012 01:55PM UTC

Closed September 23, 2012 08:59AM UTC

Last modified October 22, 2012 01:09AM UTC

.removeClass(undefined) works not as expected

Reported by: Owned by:
Priority: low Milestone: None
Component: attributes Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:

An empty function call is not the same, as calling a function with an undefined variable.

If we check against !arguments.length instead of undefined, we can tell apart these situations.


.removeClass() - removes all classes, as expected

.removeClass(undefined) - also removes all classes, which is wrong in my eyes


.removeClass(undefined) - removes nothing, like null, false and "" do

Pull Request


I noticed this while calling element.removeClass(someObject.someVar);

where the object was defined, but someVar was undefined, so this is a pretty common situation, I think.

Attachments (0)
Change History (5)

Changed August 28, 2012 02:22PM UTC by timmywil comment:1

component: unfiledattributes
owner: →
priority: undecidedlow
status: newpending
type: bugenhancement

Please add a test supporting this change in the PR.

Changed August 28, 2012 09:59PM UTC by matjae comment:2

Changed September 09, 2012 04:21AM UTC by mikesherov comment:3

type: enhancementfeature

Changed September 23, 2012 08:59AM UTC by trac-o-bot comment:4

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Changed October 22, 2012 01:09AM UTC by Matthias Jäggli comment:5

resolution: invalidfixed

Fix #12411, .removeClass(undefined) is a chaining no-op. Close gh-913.

.removeClass() removes all classes, as documented

.removeClass(window.nonExistentVariable) removes nothing

Changeset: 227c49a4596423a125bdcb1d25a2263e526360db