Skip to main content

Bug Tracker

Side navigation

#13528 closed bug (notabug)

Opened February 27, 2013 05:04PM UTC

Closed February 27, 2013 05:16PM UTC

Last modified February 28, 2013 01:29PM UTC

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:

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.

Attachments (0)
Change History (3)

Changed February 27, 2013 05:16PM UTC by dmethvin comment:1

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**.

Changed February 28, 2013 10:56AM UTC by anonymous comment:2

Which is not working, as the jsfiddle demonstrates.

Changed February 28, 2013 01:29PM UTC by dmethvin comment:3

It most certainly does: