W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2005

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

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 5 Apr 2005 11:12:58 +0000 (UTC)
Message-ID: <Pine.LNX.4.61.0504051059320.20461@dhalsim.dreamhost.com>
On Tue, 5 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?

If you maintain (as I do) that the first <h1> is the document's title -- 
the same as the <title> element but without the requirement that it be 
phrased so that it can be quoted out of context -- then yes. The first 
section is the <body>, the <body> is the document's content, and the spec 
currently says:

# The first heading in a sectioning element gives the header for that 
# section.

The content at the top of the <body> is part of the <body>, and thus it is 
associated with the <body>'s heading.

Why would you _not_ want the navigation links, or the byline, or the 
dedication, etc, to be associated with the document's first section? It 
seems correct to me.


> 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.

Do you have any examples? As far as I can tell we always want the first 
heading of a section (assuming it isn't preceeded by any subsections) to 
be the heading of the section.


> 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.

But this will be happening all over the place.

  <body>
   <p>Fox Publications Presents:</p>
   <h1>The Big Newspaper</h1>
   <article>
    <h2>Flood in town</h3>
    <section>
     <h2>Geography</h2>
     ...
    </section>
   </article>

The first <p> is clearly part of the same section as the first <h1>. The 
whitespace node before the two <h2> elements are similarly obviously part 
of their <section>, and the <h2>s clearly don't start a separate section 
that is independent of the <article> and <section> elements.


> > 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?

Because the spec is defined in terms of nodes, and introducing special 
rules for nodes that only contain space characters is a recipe for 
confusion and lack of interoperability (I'm talking from experience here).


> 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>.

It might well be rendered (e.g. due to 'whitespace: pre').

> 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. ;)

I am suggesting that, and by extension, I'm suggesting that the first node 
(whatever it is) be associated with te first section, and that that be 
associated with the first heading.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 5 April 2005 04:12:58 UTC

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