W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2006

[whatwg] [html5] tags, elements and generated DOM

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 24 Feb 2006 02:34:00 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0602240229570.315@dhalsim.dreamhost.com>
On Wed, 6 Apr 2005, Lachlan Hunt wrote:
> Ian Hickson wrote:
> > On Wed, 6 Apr 2005, Lachlan Hunt wrote:
> > > > The <body> will always be implied, though.
> > > 
> > > Not in a conforming SGML parser...
> > 
> > Yeah, I meant in browsers, not per SGML.
> 
> Ok, fair enough.  But can you explain why Opera doesn't when in 
> standards-compliant mode, as I explained in my previous e-mail.  Is it a 
> bug or intentional?

Bug.


> > According to the HTML spec, the handling of the above is completely 
> > undefined since it is invalid. (Note that something being invalid or 
> > non-conformant does _not_ make the rendering undefined in most cases 
> > in Web Apps 1 / HTML5. That's one of the main things I'm making sure 
> > of.)
> 
> Ok, if the spec is going to address this, then I think it should say something
> like:
> 
>   "If a required element with an optional start-tag is entirely missing
>    from the document, a user agent *may* imply it and include it within
>    the DOM.  Missing elements with required start-tags *must not* be
>    automatically implied.

It's been defined much more explicitly. Let me know if the current text 
doesn't satisfy you.


>   "Note: It is common for existing user agents to automatically imply
>    both the head and body elements, even when those sections are omitted
>    entirely from the document markup."

I haven't included this. Do you think I should?


> I used "may", because if "must" or "should" were used instead, it may 
> conflict with anything the SGML spec says on the matter and it would 
> make OpenSP, and thus the validator, non-conformant.  I would stick with 
> "may" because, as I showed previously, existing UAs don't do the same 
> for <tbody>.

OpenSP and the validator are already non-conformant to HTML5 for many 
other reasons unrelated to parsing (e.g. they don't do attribute value 
conformance checking).


> I included the part about start-tags because elements like <li> (which 
> require a start-tag) do not be implied by existing UAs when they are 
> missing.

Indeed. This is all fully defined by HTML5 now.


> Also, while on the topic of handling invalid documents, is this spec 
> going to attempt to address the <x><y></x></y> problem?

Yes, that is covered and fully defined too, using a variation of what 
Mozilla and Safari do as the basis for the specification.


> > > Opera and OpenSP correctly don't imply the missing head element.
> > 
> > I'm not sure what you mean by "correctly" here
> 
> Well, I read somewhere that OpenSP is "the reference implementation" of 
> SGML, so I assumed that means what it does is correct.

So what if the spec and the implementation disagree? :-)


> > since an HTML4 document without a <title> is invalid and thus parsing 
> > is undefined in HTML4.
> 
> Is it not defined by SGML either?  I really must get a copy of 
> Goldfarb's SGML Handbook later and check for sure.

Not as far as I recall, certainly.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 23 February 2006 18:34:00 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:26 UTC