Re: suggestion for abolition of <hgroup>

On Sun, Dec 26, 2010 at 2:10 PM, Ian Hickson <ian@hixie.ch> wrote:

>
> For this markup:
>
>   <hgroup>
>    <h1>HTML</h1>
>    <h2>A markup language for the Web</h2>
>   </hgroup>
>
> ...a rule to style the subheading would be:
>
>   hgroup > h2 { ... }
>
> In practice there's no need for a generic solution since the author of the
> CSS also controls the markup.


I would accept that in most cases there is no need for a fully generic
solution.  Nonetheless I think there will be cases where generic solutions
are desirable. For example, I can imagine wanting to write an XSLT transform
to generate a ToC or to perform heading autonumbering, and ideally I would
want it to work on any valid XHTML5 document, so it could be useful to as
wide an audience as possible.

I wonder whether the following formulation of hgroup has been considered:
hgroup contains flow content with exactly one child (or possibly
descendant?) which is an h[1-6].  With this formulation, your example might
become:

  <hgroup>
   <h1>HTML</h1>
   <div>A markup language for the Web</div>
  </hgroup>

I prefer this because the part that is marked as an <h1> is the part that
behaves like an <h1> for all purposes (including the outline). The
heading-ness of the subheading is indicated by the inclusion of the
subheading in the <hgroup>; there is no logical need to repeat this by also
marking it as an <h2>.  This allows hN to be used exclusively to indicate
the main heading of a Nth-level section.

James

Received on Thursday, 30 December 2010 03:19:20 UTC