Side navigation
#10656 closed bug (wontfix)
Opened November 03, 2011 06:48PM UTC
Closed November 03, 2011 07:01PM UTC
Last modified November 22, 2011 11:01AM UTC
.removeData( list) does not appear to work
Reported by: | josh.gruber@cynergysystems.com | Owned by: | rwaldron |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | data | Version: | 1.6.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
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:
Attachments (0)
Change History (9)
Changed November 03, 2011 06:58PM UTC by comment:1
component: | unfiled → data |
---|---|
owner: | → rwaldron |
status: | new → assigned |
Changed November 03, 2011 07:01PM UTC by comment:2
priority: | undecided → low |
---|---|
resolution: | → wontfix |
status: | assigned → closed |
.removeData()
will not remove the actual data-* attributes from the DOM element. To actually remove an attribute, you must use removeAttr()
Changed November 03, 2011 07:02PM UTC by comment:3
Please see the third fiddle from the original ticket: http://jsfiddle.net/mKPYN/4/
Changed November 03, 2011 07:07PM UTC by comment:4
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.
Changed November 03, 2011 07:20PM UTC by comment:5
keywords: | → needsdocs |
---|
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.
Changed November 03, 2011 07:30PM UTC by comment:6
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
Changed November 03, 2011 07:34PM UTC by comment:7
Thank you, I did overlook the "version added: 1.7" on the api documentation, I didn't realize the documentation included unreleased features.
Changed November 03, 2011 08:32PM UTC by comment:8
Well jQuery 1.7 is now shipping, as of 10 minutes ago. The docs were updated yesterday. If we don't update the docs before we ship then people won't know what is new. It's hard to do it all simultaneously.
Changed November 22, 2011 11:01AM UTC by comment:9
keywords: | needsdocs |
---|