Skip to main content

Bug Tracker

Side navigation

#9691 closed bug (duplicate)

Opened June 29, 2011 01:02AM UTC

Closed June 29, 2011 09:17PM UTC

Last modified June 29, 2011 09:17PM UTC

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

Reported by: justnewbee@gmail.com Owned by: rwaldron
Priority: low Milestone: 1.next
Component: data Version: 1.6.1
Keywords: needsreview Cc:
Blocked by: Blocking:
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.

Attachments (0)
Change History (7)

Changed June 29, 2011 04:34AM UTC by rwaldron comment:1

component: unfileddata
priority: undecidedlow
resolution: → wontfix
status: newclosed

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

Changed June 29, 2011 05:03AM UTC by justnewbee@gmail.com comment:2

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.

Changed June 29, 2011 01:19PM UTC by timmywil comment:3

keywords: → needsreview
resolution: wontfix
status: closedreopened

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/

Changed June 29, 2011 01:20PM UTC by timmywil comment:4

status: reopenedopen

Changed June 29, 2011 02:45PM UTC by rwaldron comment:5

owner: → rwaldron
status: openassigned

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

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

resolution: → duplicate
status: assignedclosed

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

Duplicate of #9413.