Skip to main content

Bug Tracker

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 rwaldron comment:1

component: unfileddata
priority: undecidedblocker
resolution: → duplicate
status: newclosed

Changed May 24, 2011 04:58PM UTC by rwaldron comment:2

Duplicate of #7328.

Changed June 11, 2011 06:53AM UTC by anonymous 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 rwaldron comment:4

resolution: duplicate
status: closedreopened

Changed June 29, 2011 09:16PM UTC by rwaldron comment:5

owner: → rwaldron
status: reopenedassigned

Changed June 29, 2011 09:17PM UTC by rwaldron comment:6

#9691 is a duplicate of this ticket.

Changed June 29, 2011 09:17PM UTC by rwaldron comment:7

#9700 is a duplicate of this ticket.

Changed June 29, 2011 09:17PM UTC by rwaldron 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 rwaldron comment:9

Changed July 02, 2011 07:10PM UTC by dmethvin comment:10

#9730 is a duplicate of this ticket.

Changed July 12, 2011 06:19PM UTC by john comment:11

milestone: 1.next1.7

Changed July 26, 2011 01:50PM UTC by rwaldron comment:12

#9909 is a duplicate of this ticket.

Changed August 01, 2011 04:17PM UTC by john comment:13

milestone: 1.71.6.3

Changed August 05, 2011 02:06PM UTC by rwaldron comment:14

Changed August 05, 2011 02:44PM UTC by Dave Methvin comment:15

resolution: → fixed
status: assignedclosed

Merge pull request #455 from rwldrn/9413

Supports interoperable removal of hyphenated/camelCase properties. Fixes #9413

Changeset: 37254bab91b6e006716029c599bab06792015925

Changed September 02, 2011 06:38PM UTC by rwaldron comment:16

#10194 is a duplicate of this ticket.