Re: The future of XML related technologies in Mozilla

Boris Zbarsky <[email protected]> Wed, 01 Nov 2006 09:50:09 -0600
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
Ian Hickson wrote:
> Well, the reason would be "it's there" in the case of elements, and 
> "consistency" in the case of documents. But the name isn't important to 
> me (and your opinion on it has been noted), the important thing is that it 
> makes document serialisation and parsing trivial.

I maintain that it still makes the simple use case of "serialize this node and 
all its descendants" nontrivial.  Compare:

   var str = (new DOMSerializer()).serializeToString(node);

vs

   var doc = document.implemenentation.createDocument(null, null, null);
   var clone = doc.importNode(node);
   doc.appendChild(clone);
   var str = doc.innerHTML;

I agree that the equally simple use case of "serialize all descendants of this 
node but not this node" is harder with DOMSerializer.  The question is which one 
is more useful, I guess...

> Why wouldn't they just pass the raw Document or Element around?

Good question!  But they won't.  ;)  Imo, of course.

-Boris