HTMLness bit on script-created documents

View: New views
5 Messages — Rating Filter:   Alert me  

HTMLness bit on script-created documents

by Henri Sivonen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In reference to https://bugzilla.mozilla.org/show_bug.cgi?id=520969:

Gecko currently looks at the doctype passed to createDocument() in  
order to decide what interfaces to offer on the returned document and  
in order to determine if the HTMLness bit gets set. This behavior was  
added for Acid3 https://bugzilla.mozilla.org/show_bug.cgi?id=450160 
and is endorsed by a "may" statement in DOM Level 3 Core:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-2-Core-DOM-createDocument
WebKit and Opera don't implement this behavior and always return a  
Document that doesn't have the HTMLness bit set.

DOM Level 3 Core mentions that DOM Level 2 HTML specifies a method  
called createHTMLDocument(). I see such a method in DOM Level 2 HTML  
CR http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html but I  
don't see it in the REC http://www.w3.org/TR/DOM-Level-2-HTML/ 
html.html. Gecko doesn't implement this method but Opera and WebKit do.

Hixie:
Is there a reason why HTML5 doesn't mention createHTMLDocument()? Does  
HTML5 contradict the DOM Level 3 Core "may" about createDocument() on  
purpose?

--
Henri Sivonen
hsivonen@...
http://hsivonen.iki.fi/




Re: HTMLness bit on script-created documents

by Anne van Kesteren-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 08 Oct 2009 13:37:22 +0200, Henri Sivonen <hsivonen@...> wrote:
> Hixie:
> Is there a reason why HTML5 doesn't mention createHTMLDocument()? Does  
> HTML5 contradict the DOM Level 3 Core "may" about createDocument() on  
> purpose?

Having another list of magic DOCTYPE strings that trigger HTMLness for  
createDocument() seems annoying. I don't think we should have that. If we  
want something explicit createHTMLDocument() makes sense to me.


--
Anne van Kesteren
http://annevankesteren.nl/


Re: [whatwg] HTMLness bit on script-created documents

by Maciej Stachowiak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Oct 8, 2009, at 4:37 AM, Henri Sivonen wrote:

> In reference to https://bugzilla.mozilla.org/show_bug.cgi?id=520969:
>
> Gecko currently looks at the doctype passed to createDocument() in  
> order to decide what interfaces to offer on the returned document  
> and in order to determine if the HTMLness bit gets set. This  
> behavior was added for Acid3 https://bugzilla.mozilla.org/show_bug.cgi?id=450160 
>  and is endorsed by a "may" statement in DOM Level 3 Core:
> http://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-2-Core-DOM-createDocument
> WebKit and Opera don't implement this behavior and always return a  
> Document that doesn't have the HTMLness bit set.

This implies that it's not necessary to ever set the HTMLness bit from  
createDocument to pass Acid3.

I believe it's only necessary to make XHTML 1.0 documents implement  
the HTMLDocument interface, which is justified by DOM2 HTML. That is  
what WebKit does, although in a hamfisted and possibly wrong way. Our  
plan is to eventually do the HTML5 thing and support all FooDocument  
interfaces on all documents.

Regards,
Maciej



Re: [whatwg] HTMLness bit on script-created documents

by Olli Pettay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/8/09 5:01 PM, Maciej Stachowiak wrote:

>
> On Oct 8, 2009, at 4:37 AM, Henri Sivonen wrote:
>
>> In reference to https://bugzilla.mozilla.org/show_bug.cgi?id=520969:
>>
>> Gecko currently looks at the doctype passed to createDocument() in
>> order to decide what interfaces to offer on the returned document and
>> in order to determine if the HTMLness bit gets set. This behavior was
>> added for Acid3 https://bugzilla.mozilla.org/show_bug.cgi?id=450160
>> and is endorsed by a "may" statement in DOM Level 3 Core:
>> http://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-2-Core-DOM-createDocument
>>
>> WebKit and Opera don't implement this behavior and always return a
>> Document that doesn't have the HTMLness bit set.
>
> This implies that it's not necessary to ever set the HTMLness bit from
> createDocument to pass Acid3.
The HTMLness wasn't implemented because of ACID3. It was implemented
because it was wanted that .createDocument() could return documents
which might get created in other ways too (like loading a page).
So it is possible to create svg/html/xhtml/etc documents.

Of course this all would get simpler if HTML5's proposal to make
all documents to implement all interfaces was implemented.
But there is still the 'whether or not to set HTMLness flag' issue.


-Olli






Re: HTMLness bit on script-created documents

by Ian Hickson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 8 Oct 2009, Henri Sivonen wrote:
>
> Gecko currently looks at the doctype passed to createDocument() in order to
> decide what interfaces to offer on the returned document and in order to
> determine if the HTMLness bit gets set.

All interfaces should be supported, per HTML5.

The bit should not be set, per HTML5.


> DOM Level 3 Core mentions that DOM Level 2 HTML specifies a method
> called createHTMLDocument(). I see such a method in DOM Level 2 HTML CR
> http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html but I don't
> see it in the REC http://www.w3.org/TR/DOM-Level-2-HTML/html.html. Gecko
> doesn't implement this method but Opera and WebKit do.
>
> Is there a reason why HTML5 doesn't mention createHTMLDocument()?

As you say, it wasn't in the DOM2 HTML REC. I'd rather not have it at all,
if we don't need it.


On Thu, 8 Oct 2009, Olli Pettay wrote:
>
> The HTMLness wasn't implemented because of ACID3. It was implemented
> because it was wanted that .createDocument() could return documents
> which might get created in other ways too (like loading a page). So it
> is possible to create svg/html/xhtml/etc documents.

That's the interface, but why the HTMLness bit? (Affects things like
document.write().)


Unless there's a good use case, I would suggest we don't add a way to
create such documents just for the sake of it.

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