Skip to main content

Bug Tracker

Side navigation

#14311 closed bug (duplicate)

Opened August 28, 2013 12:02AM UTC

Closed August 28, 2013 12:33AM UTC

Last modified August 28, 2013 05:41PM UTC

removeClass fails when passed undefined

Reported by: darkcryst@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:
Description

See line 58 of classes.js

https://github.com/jquery/jquery/blob/c418b94eb48188cd9329519ae5e030a52dd81cc9/src/attributes/classes.js#L58

This matters a LOT when used with jQuery UI as it will pass undefined to the core function *always*.

Slightly shocked that there isn't a test case for this...

Attachments (0)
Change History (6)

Changed August 28, 2013 12:13AM UTC by darkcryst@gmail.com comment:1

Note - test with jQuery UI 1.9 to see elem.removeClass() function fail silently.

Passing undefined isn't even required with that. It just outright fails (due to how 1.9 is written, UI 1.10 actually works around this bug with a much more complicated solution but the bug is actually in jquery core).

Changed August 28, 2013 12:33AM UTC by scottgonzalez comment:2

resolution: → duplicate
status: newclosed

Duplicate of #13367.Why would there be a test case for a usage that isn't documented as doing anything?

Changed August 28, 2013 02:26PM UTC by gibson042 comment:3

Changed August 28, 2013 05:32PM UTC by darkcryst@gmail.com comment:4

To be clear then: it is undocumented behavior that *used to* work, and has caused a bug in jQuery UI. It may be intentional now, fine, but it is undocumented. So that needs to be fixed - it should be in the documentation and added to migration guidelines.

The reason I know this used to work is that I just upgrade a very large website (with 10's of millions of users) to use the 1.10.x branch. They were a couple of years out of date - but this worked fine.

This undocumented but previously reliable behavior change broke a good few things. Like it did on a very recent version of jQuery that is still available for download (1.9.x).

So even if it is *intended* I'd question the reasoning behind that intention.

Changed August 28, 2013 05:35PM UTC by dmethvin comment:5

This is a heartwarming story of triumph and tragedy, but it lacks a jsfiddle.net case.

Changed August 28, 2013 05:41PM UTC by scottgonzalez comment:6

it is undocumented behavior that *used to* work, and has caused a bug in jQuery UI.

Anything that is undocumented is invalid, regardless of whether it happens to work at a given point in time. Yes, the change revealed a bug in jQuery UI. That bug was fixed seven months ago.