$.fn.removeData does not remove data with a dash in a name
|Reported by:||sidonath||Owned by:||rwaldron|
Some of the backwards-compatibility issues with camelCasing data names were solved in #9124, but not all.
Here is a test case that demonstrates the issue.
Expectation: $('#foo').removeData('foo-bar') removes data with key "fooBar"
But actually: $('#foo').removeData('foo-bar') doesn't remove anything. To remove the "fooBar" one has to explicitely call $('#foo').removeData('fooBar')
The current handling breaks old code ported to jQuery 1.6.1, but the release notes say that the upgrade should be seamless with respect to data changes in 1.6.0.
Solution: when removing "foo-bar", remove "fooBar" instead.
Workaround for developers: update code to use "fooBar" always.
Change History (16)
comment:1 Changed 5 years ago by rwaldron
- Component changed from unfiled to data
- Priority changed from undecided to blocker
- Resolution set to duplicate
- Status changed from new to closed
comment:4 Changed 5 years ago by rwaldron
- Resolution duplicate deleted
- Status changed from closed to reopened
comment:5 Changed 5 years ago by rwaldron
- Owner set to rwaldron
- Status changed from reopened to assigned
comment:15 Changed 5 years ago by Dave Methvin
- Resolution set to fixed
- Status changed from assigned to closed