[whatwg] <hgroup> functionality absorbed into <header>?
Kornel Lesinski
kornel at geekhood.net
Sun Oct 18 06:18:21 PDT 2009
On Sun, 18 Oct 2009 08:54:59 +0100, Ian Hickson <ian at hixie.ch> wrote:
>> Your version with split <h2> seems to use it only for visual effect.
>
> Not just visual, but presentational, yes, pretty much. It also makes it
> clear how to generate the outline.
I don't understand how presentational <h2>s make outline clear. I thought
they're an exception that didn't work simple outline algorithm:
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.w3.org%2FTR%2Fhtml5%2F&outline=1#outlineresult
and <hgroup> exists to resolve ambiguity caused by presentational use of
headers.
>> I still think that <subtitle> (subheader, tagline) would be just as
>> effective, less confusing and less likely to break outline when used
>> improperly...
>
> How is <h2> confusing?
<h2> alone isn't. <hgroup> is the source of confusion.
* Difference between <hgroup> and <header> is not obvious. It wasn't to me
when I first saw them, and this isn't first thread about them.
* Makes meaning of <hx> overloaded (sometimes it's a header that affects
outline and level or other headers, sometimes it's a subheader that
doesn't do anything that header would).
Have you seen this post? http://www.onderhond.com/blog/work/the-hgroup-tag
I think it sums up problems quite well.
> I think something like <subtitle> is just as likely to be misused as
> <hgroup>, to be honest.
Sure, but it's much more fail-safe. If you use <header> instead of
<hgroup> or fail to use <hgroup>, you may significantly change structure
of the document.
You can't make much damage with <subheader>. Sections will remain correct
and at worst you'll add wrong subtitles to headers.
My proposal for processing of <subheader>:
* look for first <hx> preceeding <subheader> in tree order (depth-first
starting with last child) [makes any <subheader> after <hx> work]
* abort and ignore subheader when search crosses section boundaries
[prevents misplaced <subheader> from being associated with wrong section].
Optionally:
* if <hx> is an ancestor of <subheader>, associate subheader with that
header
The last rule allows:
<h1><subheader>The magnificent</subheader> HTML 5 specification</h1>
which addresses one of use cases you've mentioned a while ago when
<hgroup> was discussed.
> Also, it has a much poorer legacy (backwards compatibility) story.
Both solutions have problems. I don't think ones are much worse than the
others. <hgroup> breaks the outline, <subheader> is ignored. Without CSS
<h2>s will be too large and have too big margins. <subheader> will not get
special rendering, but at least will look like block element (<hx> and <p>
typically surrounding it will cause this). One might use <p><subheader><b>
if non-CSS display is a concern.
With CSS <subheader> will work fine and doesn't limit styling
possibilities. <hgroup>'s content model doesn't allow any non-header
elements, so one can't add any extra hooks for styling:
<hgroup>
<h1/>
<div><!-- add fancy border around subheaders? -->
<h2/>
<h2/>
</div>
</hgroup>
Another thing - can you write XPath query that extracts all headers from
the document? Without <hgroup> it's simple. With <hgroup> I'm not sure if
I could manage to write correct query.
--
regards, Kornel Lesinski
More information about the whatwg
mailing list