#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: |
Description
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.
The documentation is correct and clear. The those refers to HTML5 data attributes and indeed you must use
.removeAttr()
to remove those.