Re: The future of XML related technologies in Mozilla

Ian Hickson <[email protected]> Wed, 1 Nov 2006 17:44:31 +0000 (UTC)
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
On Wed, 1 Nov 2006, Boris Zbarsky wrote:
>
> 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;

No no, innerHTML would apply to everything, so the equivalent would be:

   var str = node.innerHTML;

(Currently the spec says it applies to HTMLElement only, but I'd be happy 
to put it on Element if you think there's a use case for that.)


> > Why wouldn't they just pass the raw Document or Element around?
> 
> Good question!  But they won't.  ;)  Imo, of course.

I'm still confused as to the use case.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'