Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for XMLHttpRequest.responseXML #16

Open
jp30566347 opened this issue May 14, 2015 · 2 comments
Open

Support for XMLHttpRequest.responseXML #16

jp30566347 opened this issue May 14, 2015 · 2 comments

Comments

@jp30566347
Copy link

I don't see any support for that attribute, however it seems that it is in the spec:
http://www.w3.org/TR/XMLHttpRequest/#the-responsexml-attribute

I think it would be really easy to integrate a DOMParser kind of object and add this extension.
What do you think?

Edit: I would contribute a pull request upon confirmation that this an issue, but I'd also require some hint as to how to integrate the xml parser.

@pwnall
Copy link
Owner

pwnall commented May 30, 2015

I'm wary of adding this support. It'd require xhr2 to choose a DOM parser for people, and I don't think there's a universally accepted parser. Also, doing this would require a good amount of research, because I'd want a parser that meets the WHATWG / W3C specs.

FWIW, responseXML is not supported in Web workers, so your code will be at least somewhat non-portable if you rely on this property.
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties

If you don't need portable code, I'd suggest using whatever parser you'd like on responseText. If you do, perhaps try a DOMParser polyfill?
For example, https://github.com/jindw/xmldom looks good, but it only supports DOM2. If that's sufficient for your purposes, it might do the trick.

@jp30566347
Copy link
Author

Why not use xmldom then? That's what I use and it's working great AFAIK and DOM2 is better than nothing. No need to make this a hard requirement, you could make it optional and ask for a DOM parser implementation and expect the W3C format?

As for web workers, I don't get why would I use this library with web workers, aren't people using web worker using the native browser XMLHttpRequest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants