Bug Tracker

Modify

Ticket #9413 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

$.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:
Blocking: Blocked by:

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

comment:1 Changed 3 years ago by rwaldron

  • Priority changed from undecided to blocker
  • Resolution set to duplicate
  • Status changed from new to closed
  • Component changed from unfiled to data

comment:2 Changed 3 years ago by rwaldron

Duplicate of #7328.

comment:3 Changed 3 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 3 years ago by rwaldron

  • Status changed from closed to reopened
  • Resolution duplicate deleted

comment:5 Changed 3 years ago by rwaldron

  • Owner set to rwaldron
  • Status changed from reopened to assigned

comment:6 Changed 3 years ago by rwaldron

#9691 is a duplicate of this ticket.

comment:7 Changed 3 years ago by rwaldron

#9700 is a duplicate of this ticket.

comment:8 Changed 3 years ago by rwaldron

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

comment:9 Changed 3 years ago by rwaldron

comment:10 Changed 3 years ago by dmethvin

#9730 is a duplicate of this ticket.

comment:11 Changed 3 years ago by john

  • Milestone changed from 1.next to 1.7

comment:12 Changed 3 years ago by rwaldron

#9909 is a duplicate of this ticket.

comment:13 Changed 3 years ago by john

  • Milestone changed from 1.7 to 1.6.3

comment:15 Changed 3 years ago by Dave Methvin

  • Status changed from assigned to closed
  • Resolution set to fixed

Merge pull request #455 from rwldrn/9413

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

Changeset: 37254bab91b6e006716029c599bab06792015925

comment:16 Changed 3 years ago by rwaldron

#10194 is a duplicate of this ticket.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.