[whatwg] <h1> to <h6> in <body>

Matthew Raymond mattraymond at earthlink.net
Mon Apr 4 21:25:40 PDT 2005

Ian Hickson wrote:
> On Mon, 4 Apr 2005, Matthew Raymond wrote:
>>   That said, this is how I would process the sample markup:
>>    <body>
>>     <p>...</p>               <unnamed section>
>>     <h1>A</h1>               1        A (importance level 1)
> I agree with most of what you said but the problem I have with the above 
> is that it means almost every document will have an anonymous section at 
> the top, and I don't think that makes sense.

    If "<p>...</p>" were instead a list of hyperlinks to different 
sections of the document, should that list be part of the first section? 
If the paragraph inside the <p> element starts with "I'd like to thank 
such-and-such for sticking by me while I wrote this...", is that part of 
the first section?

    The way I see it, if a heading starts a section, it should always be 
the start of a section. To do otherwise breaks consistency and may 
introduce semantics that are not backwards compatible in some situations.

    Better to use something like "[Top of the document]" that denotes 
that describes the position of the content without naming it, and also 
identifies that there is content before the first heading.

|    <body>
|     <p>...</p>    | <Top> (importance level 1)
|     <h1>A</h1>    | 1  A  (importance level 1)

> Even in the case of:
>    <body>
>     <h1>...</h1>
> ...there's an anonymous section, because you have a whitespace text node 
> before the element. That doesn't really work for me.

    Why do outline generators need to worry about text nodes at the 
beginning that contain only whitespace? You're talking about content 
that won't be rendered, so for all intents and purposes, the heading is 
the first item in the <body>. Such whitespace can simply be ignored by 
outliners. However, if you are suggesting that such unrendered 
whitespace be associated with the first section, I have no problem with 
that. ;)

More information about the whatwg mailing list