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
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 comment:1
Changed August 28, 2013 12:33AM UTC by comment:2
resolution: | → duplicate |
---|---|
status: | new → closed |
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 comment:3
Not only is this behavior intentional, but it ''is'' tested: https://github.com/jquery/jquery/blob/a7a3b8ce1b602f4e87539e934005875e648be192/test/unit/attributes.js#L1187-L1194
Changed August 28, 2013 05:32PM UTC by 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 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 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.
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).