Skip to main content

Bug Tracker

Side navigation

#6890 closed enhancement (patchwelcome)

Opened August 09, 2010 07:34PM UTC

Closed April 16, 2011 09:46PM UTC

Last modified March 13, 2012 10:16PM UTC

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:

1. Load XML doc via $.ajax.

2. In success callback, $(data).find("anyNode").data("myDataKey", "my value");

Attachments (0)
Change History (7)

Changed August 09, 2010 07:41PM UTC by stephenr85 comment:1

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.

Changed August 10, 2010 12:00AM UTC by dmethvin comment:2

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.

Changed October 07, 2010 06:59PM UTC by addyosmani comment:3

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

Changed October 15, 2010 04:54PM UTC by addyosmani comment:4

status: newopen
type: bugenhancement

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.

Changed November 12, 2010 02:39AM UTC by snover comment:5

milestone: 1.4.3

Resetting milestone to future.

Changed March 25, 2011 05:09PM UTC by ddstreet comment:6

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

Changed April 16, 2011 09:46PM UTC by john comment:7

resolution: → patchwelcome
status: openclosed

Yeah, I don't think that this is something that we can reasonably resolve. Patches welcome.