Re: Why hgroup?

On Sat, Jan 8, 2011 at 2:51 AM, Leif Halvard Silli
<xn--mlform-iua@xn--mlform-iua.no> wrote:
> Anne van Kesteren, Thu, 06 Jan 2011 19:14:07 +0100:
>> On Thu, 06 Jan 2011 19:04:11 +0100, Steve Faulkner
>> <faulkner.steve@gmail.com> wrote:
>>> So sibling selectors are not good enough for CSS/JavaScript & shared
>>> classes for CSS ?
>>
>> They are not as good, no. People constantly complain about the way
>> <dl> works, for instance. And having <hgroup class=x> is much better
>> in my opinion than <h2 class=x>foo</h2><blah class=x>bar</blah>.
>
> I am still analysing <hgroup>. But nevertheless, your analysis *here*
> seems wrong: <dl> is actually the HTML4 elements that resembles
> <hgroup> the most:
>
> <hgroup>
>        <h1>Term</h1>
>        <h2>Definition</h2>
> </hgroup>
>
> And, as not least you yourself have pointed out (in blogs etc): one can
> also do do
>
> <dl>
>        <dt>Term 1</dt>
>        <dt>Term 2</dt>
>        <dd>Definition</dd>
> </dl>
>
> Thus, for both <hgroup> and <dl> it is the case that the second child
> is not as obvious as one is inclined to think: in <dl> it does not need
> to be a <dd> element - it could be a second <dt> element. And in
> <hgroup>, the second element  does not need to be a subtitle to the
> first child element.
>
> So if people complain on <dl>, they might complain on <hgroup> as well,
> for quite similar reaions. However, the complaints about <dl> are
> mostly related to the bad support in use agents: DL requires user
> agents which supports the adjacent CSS selector, to be easily styled
> etc.

You are completely misunderstanding the distinction Anne is trying to
make.  Your example is too trivial to show the problem that people
have with <dl>.

When dealing with <dl>s, it's common to want to style a term/data
block as a unit, which the sibling relationship that <dt> and <dd>
have does not allow.

That is, people often *want* structure like:

<dl>
  <di>
    <dt>term
    <dd>data
  </di>
  <di>
    <dt>term
    <dd>data
  </di>
</dl>

<hgroup> offers that sort of grouping functionality.
<h1>/<subheading> does not - they suffer from the same problems that
<dt>/<dd> do currently.

~TJ

Received on Monday, 10 January 2011 20:58:57 UTC