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

Re: How can I create a HTMLDocument from the DOMImplementation

From: Jonas Sicking <jonas@sicking.cc>
Date: Sat, 29 Aug 2009 23:55:40 -0300
Message-ID: <63df84f0908291955x18c0333fm93fa34f59e8fb9a@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: Alex Russell <slightlyoff@google.com>, Bo Yang <struggleyb.nku@gmail.com>, www-dom@w3.org
On Sat, Aug 29, 2009 at 10:53 PM, Ian Hickson<ian@hixie.ch> wrote:
> 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?

Make document.open() do nothing other than throw an exception. That's
what we do now:

http://mxr.mozilla.org/mozilla-central/source/content/html/document/src/nsHTMLDocument.cpp#1796

/ Jonas
Received on Sunday, 30 August 2009 02:56:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:03 GMT