Re: How can I create a HTMLDocument from the DOMImplementation

On Wed, 19 Aug 2009, Jonas Sicking wrote:
> >> >
> >> > Yeah, that's one way. Immediately call .open() on the Document 
> >> > after creating it.
> >>
> >> Wow, that's a really unintuitive design. Why was this design chosen?
> >
> > It wasn't really chosen. I think we just ended up there while trying 
> > to address other issues.
> 
> What other issues?

document.write and XML, getting EOF to work in the tokeniser, handling of 
timouts and pending database accesses across document.open() and across 
history traversal, etc.


> I.e. what would be lost by making the choise between a "text/html 
> document" vs "non-text/html document" be chosen at construction time?
>
> One thing that seems unfortunate with the current API is that you can 
> call .open() on a document dynamically, thus changing behavior of any 
> node which has that node as ownerDocument (note that while nodes are 
> removed from the document when .open() is called, they don't change 
> ownerDocument).

There are lots of unfortunate things with the current model, but I'm not 
sure they're a big deal.

What would you like document.open() to do if called on an XML document if 
we don't convert to an HTML document?


On Wed, 19 Aug 2009, Alex Russell wrote:
> 
> In addition to being unintuitive, it's sort of terrible JavaScript API 
> design besides. It'd be more idiomatic for the Document constructor to 
> take a bag of arguments. E.g.:
> 
>    var d = new Document({ mimetype: "text/html", ... });

createDocument() is here to stay, I think. That mistake was made years 
ago, long before the HTML5 work started.

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

Received on Sunday, 30 August 2009 01:51:54 UTC