Ticket #10656 (closed bug: wontfix)
.removeData( list) does not appear to work
| Reported by: | josh.gruber@… | Owned by: | rwaldron |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | data | Version: | 1.6.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
passing a list to removeData is broken as follows (tested in IE 9 and current Chrome):
passing a list does not remove the data:
accessing the data before passing a list causes removeData to error out when passed a list:
And this happens whether the data is assigned via jquery or in the html:
Change History
comment:1 Changed 19 months ago by rwaldron
- Owner set to rwaldron
- Status changed from new to assigned
- Component changed from unfiled to data
comment:2 Changed 19 months ago by rwaldron
- Priority changed from undecided to low
- Status changed from assigned to closed
- Resolution set to wontfix
.removeData() will not remove the actual data-* attributes from the DOM element. To actually remove an attribute, you must use removeAttr()
comment:3 Changed 19 months ago by josh.gruber@…
Please see the third fiddle from the original ticket: http://jsfiddle.net/mKPYN/4/
comment:4 Changed 19 months ago by josh.gruber@…
For clarification: the third fiddle from the original ticket appears to work, but only because the script errors out before it gets to the line where it would update the DOM.
comment:5 Changed 19 months ago by rwaldron
- Keywords needsdocs added
jQuery will remove data properties that it has created with data() (these are not placed on the DOM element itself), but will not remove data-* attributes. The extent of jQuery's involvement with data-* attributes is a read-only relationship.
comment:6 Changed 19 months ago by dmethvin
The fiddle was using 1.6.4 and the api page is pretty clear that arrays are a 1.7 feature.
I have updated the .removeData() page to make it excruciatingly explicitly incredibly verbosely clear that we don't touch data- attributes with this api. There is a whole article that says more about the whole topic:
http://www.learningjquery.com/2011/09/using-jquerys-data-apis
comment:7 Changed 19 months ago by josh.gruber@…
Thank you, I did overlook the "version added: 1.7" on the api documentation, I didn't realize the documentation included unreleased features.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
