[whatwg] DOMParser / XMLSerializer

Boris Zbarsky bzbarsky at MIT.EDU
Wed May 20 20:23:40 PDT 2009

Anne van Kesteren wrote:
> or is there something that DOMParser / XMLSerializer can do that document.innerHTML cannot?

Ignoring the non-web-facing functionality (like parsing from and 
serializing to streams), and speaking only of Gecko's implementations, 
basically the following:

1)  DOMParser can parse as a given content type (in theory XML vs HTML;
     I assume that if document.innerHTML doesn't do that yet it could be
     changed to do so).
2)  DOMParser can parse from a byte array instead of a string; this
     makes it a little easier to work with XML in encodings other than
     UTF-8 or UTF-16.
2)  XMLSerializer can serialize a subtree rooted at a given node without
     removing the node from its current location in the DOM.


More information about the whatwg mailing list