[whatwg] About adopting quirks mode parsing

Ian Hickson ian at hixie.ch
Wed Jun 13 18:00:03 PDT 2007


On Wed, 19 Jul 2006, Michel Fortin wrote:
> Le 18 juil. 2006 à 21:43, Ian Hickson a écrit :
> > > 
> > > It might be desirable also that a valid HTML4 document gets a 
> > > conforming HTML4 DOM. If it is, then <p>s shouldn't contain <table>.
> > 
> > I agree.
> 
> Is this goal compatible with <blockquote>, <pre>, <ol>, <ul>, and <dl> 
> being structured inline-level elements? Let's take this valid snippet of 
> HTML 4:
> 
>    <p>Some text <ul><li>List item</li></ul>
> 
> According to HTML 4 parsers, I believe the DOM will be:
> 
>    P
>      #text: Some text
>    UL
>      LI
>        #text: List item

Right. And for compatibility with legacy content, that's what HTML5 does 
too.


> But in HTML 5, where the list can be part of a paragraph, shouldn't the 
> list be put inside the paragraph? Giving this DOM:
> 
>    P
>      #text: Some text
>      UL
>        LI
>          #text: List item
> 
> Or should the list be put inside the paragraph only when you have an 
> explicit closing <p> tag following the list (so that it becomes invalid 
> HTML 4):
> 
>    <p>Some text <ul><li>List item</li></ul></p>
> 
> ?

Neither. As it says in 8.1.2.5. Restrictions on content models [1]:

# A p element must not contain blockquote, dl, menu, ol, pre, table, or ul  
# elements, even though these elements are technically allowed inside p 
# elements according to the content models described in this 
# specification. (In fact, if one of those elements is put inside a p 
# element in the markup, it will instead imply a p element end tag before 
# it.)

The new content models only apply to the DOM and the XML serialisations, 
they can't be expressed in the HTML serialisation.

[1] http://www.whatwg.org/specs/web-apps/current-work/#restrictions

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


More information about the whatwg mailing list