Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#9413 closed bug (fixed)

$.fn.removeData does not remove data with a dash in a name

Reported by: sidonath Owned by: Rick Waldron
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.

Change History (16)

comment:1 Changed 6 years ago by Rick Waldron

Component: unfileddata
Priority: undecidedblocker
Resolution: duplicate
Status: newclosed

comment:2 Changed 6 years ago by Rick Waldron

Duplicate of #7328.

comment:3 Changed 6 years ago by anonymous

It is not a duplicate of #7328. The removeData is not working with a dash in the name.

comment:4 Changed 6 years ago by Rick Waldron

Resolution: duplicate
Status: closedreopened

comment:5 Changed 6 years ago by Rick Waldron

Owner: set to Rick Waldron
Status: reopenedassigned

comment:6 Changed 6 years ago by Rick Waldron

#9691 is a duplicate of this ticket.

comment:7 Changed 6 years ago by Rick Waldron

#9700 is a duplicate of this ticket.

comment:8 Changed 6 years ago by Rick Waldron

This is the only ticket that should exist for this issue. Please stop creating duplicates

comment:9 Changed 6 years ago by Rick Waldron

comment:10 Changed 6 years ago by dmethvin

#9730 is a duplicate of this ticket.

comment:11 Changed 6 years ago by john

Milestone: 1.next1.7

comment:12 Changed 6 years ago by Rick Waldron

#9909 is a duplicate of this ticket.

comment:13 Changed 6 years ago by john

Milestone: 1.71.6.3

comment:15 Changed 6 years ago by Dave Methvin

Resolution: fixed
Status: assignedclosed

Merge pull request #455 from rwldrn/9413

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

Changeset: 37254bab91b6e006716029c599bab06792015925

comment:16 Changed 6 years ago by Rick Waldron

#10194 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.