W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2009

Re: How can I create a HTMLDocument from the DOMImplementation

From: Ian Hickson <ian@hixie.ch>
Date: Sun, 30 Aug 2009 01:53:33 +0000 (UTC)
To: Jonas Sicking <jonas@sicking.cc>, Alex Russell <slightlyoff@google.com>, Bo Yang <struggleyb.nku@gmail.com>
Cc: www-dom@w3.org
Message-ID: <Pine.LNX.4.62.0908300149100.6775@hixie.dreamhostps.com>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:36:55 UTC