Bug Tracker

Modify

Ticket #9691 (closed bug: duplicate)

Opened 23 months ago

Last modified 23 months ago

version 1.6.1 - data method will camelize data key if "-" is used

Reported by: justnewbee@… Owned by: rwaldron
Priority: low Milestone: 1.next
Component: data Version: 1.6.1
Keywords: needsreview Cc:
Blocking: Blocked by:

Description

jQuery 1.6.1 if i call .data("x-y", someData) will not be able to find or remove the data using key "x-Y", because the data key is changed to "xY". However 1.4.2 works fine.

Change History

comment:1 Changed 23 months ago by rwaldron

  • Priority changed from undecided to low
  • Resolution set to wontfix
  • Status changed from new to closed
  • Component changed from unfiled to data

That behaviour is 100% correct per the data-* attr spec, also: see #7328

Look under "HTML 5 data- Attributes" here:  http://api.jquery.com/data

comment:2 Changed 23 months ago by justnewbee@…

i don't think this is right, because in previous versions like 1.4.2, it's ok to use "-", at least this should be a compatibility bug. how do you explain .removeData("x-y") won't work but .data("x-y") can work? another thing, .data("x-X", someData) won't be changed according to HTML5 spec? i will complain about compatibility. it's wise to handle HMTL5 data-* attributes, but it's not wise to consider user set data the same format as HTML5, it's even worse .data("x-y") can work but .removeData("x-y") fails.

comment:3 Changed 23 months ago by timmywil

  • Keywords needsreview added
  • Status changed from closed to reopened
  • Resolution wontfix deleted

I'd like to open this particular issue for discussion. I see the point here. If xY can be accessed with x-y in the .data() method, I think it should be accessible in the .removeData() method as well so that things like this don't happen:

 http://jsfiddle.net/timmywil/7d26w/

comment:4 Changed 23 months ago by timmywil

  • Status changed from reopened to open

comment:5 Changed 23 months ago by rwaldron

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

I've been working on a related ticket, so I'll take this and include it with that one.

comment:6 Changed 23 months ago by rwaldron

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

comment:7 Changed 23 months ago by rwaldron

Duplicate of #9413.

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.