[whatwg] Re: <section> and headings

Ian Hickson ian at hixie.ch
Fri Nov 12 08:33:43 PST 2004


On Thu, 2 Sep 2004, Lachlan Hunt wrote:
> James wrote:
> > (I also think that only the first heading in a section should be regarded as
> > a section title, the rest as subtitles. But I'm more ready to be persuaded
> > that that's a bad idea)
> 
> No, that is a bad idea.  Same-level structured headings should not be regarded
> as sub headings for the purpose of an outline.  (Numbered headings should work
> as I have already described.)
>
> eg.
> <section>
>     <h>Heading A</h>
>     <p>content...</p>
>     <h>Heading B</h> <!-- This is not a sub heading -->
>     <p>content...</p>
> </section>
> 
> unless you want to force authors to have to do the following which, from my
> experience of using divs for the same purpose, can result in an unmanageable
> structure when there are lots of headings.
> 
> <section>
>     <h>Heading A</h>
>     <p>content...</p>
> </section>
> <section>
>     <h>Heading B</h>
>     <p>content...</p>
> </section>

This is an interesting point. I've been wondering what to do with multiple 
headers in the same <section>.

We could say that the first <h1>-<h6> element is the top-level header for 
that section, then any headers of that level (or above, up to <h1>) open 
new sections (as if they said </section><section>, but without affecting 
the DOM -- i.e. just semantically), and any headers of lower levels (down 
to <h6>) open subsections, like in <body>.

The problem with that is it makes it not very easy to define simple DOM 
interfaces to get the current section header, etc. I was hoping to define 
an HTMLSectionElement interface where we could just have "headingElement", 
for example, which would give you the element that represents that 
section, and then "subsections" which is a NodeList of sections inside 
this one. If you allow implied sections (as in <body>) then this largely 
goes out of the window again.

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