Side navigation
#9413 closed bug (fixed)
Opened May 24, 2011 03:21PM UTC
Closed August 05, 2011 02:44PM UTC
Last modified March 17, 2012 08:47PM UTC
$.fn.removeData does not remove data with a dash in a name
Reported by: | sidonath | Owned by: | rwaldron |
---|---|---|---|
Priority: | blocker | Milestone: | 1.6.3 |
Component: | data | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
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.
Attachments (0)
Change History (16)
Changed May 24, 2011 04:58PM UTC by comment:1
component: | unfiled → data |
---|---|
priority: | undecided → blocker |
resolution: | → duplicate |
status: | new → closed |
Changed June 11, 2011 06:53AM UTC by comment:3
It is not a duplicate of #7328. The removeData is not working with a dash in the name.
Changed June 29, 2011 09:16PM UTC by comment:4
resolution: | duplicate |
---|---|
status: | closed → reopened |
Changed June 29, 2011 09:16PM UTC by comment:5
owner: | → rwaldron |
---|---|
status: | reopened → assigned |
Changed June 29, 2011 09:17PM UTC by comment:8
This is the only ticket that should exist for this issue. Please stop creating duplicates
Changed June 29, 2011 09:18PM UTC by comment:9
Test case: http://jsfiddle.net/CtJNN/
Changed July 02, 2011 07:10PM UTC by comment:10
#9730 is a duplicate of this ticket.
Changed July 12, 2011 06:19PM UTC by comment:11
milestone: | 1.next → 1.7 |
---|
Changed July 26, 2011 01:50PM UTC by comment:12
#9909 is a duplicate of this ticket.
Changed August 01, 2011 04:17PM UTC by comment:13
milestone: | 1.7 → 1.6.3 |
---|
Changed August 05, 2011 02:06PM UTC by comment:14
Changed August 05, 2011 02:44PM UTC by comment:15
Changed September 02, 2011 06:38PM UTC by comment:16
#10194 is a duplicate of this ticket.
See: #9124 #7328 #9301