Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#13528 closed bug (notabug)

removeData() not working

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:


The removeData() function isn't working. At first I though my application was just rediculously complex, but a stripped-down test-case prooves that removeData() appears to do absolutely nothing.

I created a plainvanilla div, added a data attribute, and, as per the documentation, expected it to be removed by removeData(), but it does no such thing.

See this fiddle: http://jsfiddle.net/6T6pV/

Documentation says: "Removing data from jQuery's internal .data() cache does not effect any HTML5 data- attributes in a document; use .removeAttr() to remove those."

Where I assumed "those" to refer to "HTML5 data- attributes in a document", and expected removeData to, well, remove those :) I don't know how else to read, so IMO it's a bug either in the documentation, or in jQuery itself.

Tried it on Opera 12.14 and Firefox 19.

Change History (3)

comment:1 Changed 10 years ago by dmethvin

Resolution: notabug
Status: newclosed

The documentation is correct and clear. The those refers to HTML5 data attributes and indeed you must use .removeAttr() to remove those.

comment:2 Changed 10 years ago by anonymous

Which is not working, as the jsfiddle demonstrates.

comment:3 Changed 10 years ago by dmethvin

Note: See TracTickets for help on using tickets.