Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#14311 closed bug (duplicate)

removeClass fails when passed undefined

Reported by: darkcryst@… 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...

Change History (6)

comment:1 Changed 6 years ago by darkcryst@…

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).

comment:2 Changed 6 years ago by scottgonzalez

Resolution: duplicate
Status: newclosed

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

comment:4 Changed 6 years ago by darkcryst@…

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.

comment:5 Changed 6 years ago by dmethvin

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

comment:6 Changed 6 years ago by scottgonzalez

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: See TracTickets for help on using tickets.