Skip to main content

Bug Tracker

Side navigation

#13850 closed bug (fixed)

Opened May 02, 2013 07:40PM UTC

Closed May 02, 2013 08:35PM UTC

.data() and removeData() doesn't work correctly with hyphenated property

Reported by: rospino Owned by: rwaldron
Priority: blocker Milestone: 2.0.1
Component: data Version: 2.0.0
Keywords: Cc:
Blocked by: Blocking:
Description

if data is stored for an element twice with a hyphenated property, cache stores two properties one hyphenated and one camel case. If you call removeData one property is removed. Therefore if you get the data value is returned when this should be undefined

$("#element").data("my-key", { id: 0; value: "Value0" });
$("#element").data("my-key", { id: 1; value: "Value1" });
$("#element").removeData("my-key");
$("#element").data("my-key"); //return { id: 1; value: "Value1" } when sholud be 'undefinded'
Attachments (0)
Change History (4)

Changed May 02, 2013 07:48PM UTC by rwaldron comment:1

owner: → rwaldron
status: newassigned

Changed May 02, 2013 07:59PM UTC by rospino comment:2

Demo on jsfiddle:

http://jsfiddle.net/Kgjbv/2/

Changed May 02, 2013 08:29PM UTC by timmywil comment:3

component: unfileddata
milestone: None2.0.1
priority: undecidedblocker

Changed May 02, 2013 08:35PM UTC by Rick Waldron comment:4

resolution: → fixed
status: assignedclosed

Fixes #13850. Better removal of hyphenated data property names.

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>

Changeset: 2406b5e290c1364c0a58832e0bbf4bcf82abfe10