#6890 closed enhancement (patchwelcome)
jQuery.data() does not work on XML in IE
Reported by: | stephenr85 | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | |
Component: | data | Version: | 1.4.2 |
Keywords: | IE, XML, expando | Cc: | |
Blocked by: | Blocking: |
Description
It looks like the ActiveX object that IE uses for XML does not allow the jQuery expando attribute to be attached for data() references.
Steps to produce:
- Load XML doc via $.ajax.
- In success callback, $(data).find("anyNode").data("myDataKey", "my value");
Change History (7)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
What if we documented that .data() is not supported cross-browser on XML documents? The workarounds here seem complex, and there don't seem to have been a lot of people inconvenienced by the issue.
comment:3 Changed 12 years ago by
Priority: | → undecided |
---|
@dmethvin Given that the original ticket submitter hasn't responded to this ticket in 2 months, what are your thoughts on updating the documentation to reflect your original suggestion?.
comment:4 Changed 12 years ago by
Status: | new → open |
---|---|
Type: | bug → enhancement |
We've decided to document this behavior in the API Documentation and move this ticket to enhancements. If you have any further comments please feel free to add them.
comment:6 Changed 12 years ago by
Can you also modify the documentation for the bind() function, as I used custom events on XML document elements and didn't realize that would not work on IE either. The bind() function documentation currently states you can't bind to "object, embed, or applet elements" but does not mention XML elements.
Also, I would love to see this worked around at some point, as setting data() and using events with XML elements is very useful to me and works (as far as I can tell) everywhere except IE...
comment:7 Changed 12 years ago by
Resolution: | → patchwelcome |
---|---|
Status: | open → closed |
Yeah, I don't think that this is something that we can reasonably resolve. Patches welcome.
Forgot to mention, a possible workaround would be to add the expando value as an attribute of the node, rather than a property of the object. It works, but could cause some obvious issues where the XML is sent back to the server for saving or validation. There could be a jQuery.cleanXMLData() utility method added to remove the attributes, but...bleh.
The other idea would be to store an array of {target:obj, data:obj} object and do a sort-of indexOf looking for target, but that has its efficiency issues.
If there's another workaround for adding properties to IE XML Node objects, I'd like to hear 'em.