W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2008

[whatwg] several messages about <ol>, <ul>, <dl>, and related subjects

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 26 Feb 2008 12:40:51 -0600
Message-ID: <dd0fbad0802261040y21d2cbd1r97736add4c5c72f5@mail.gmail.com>
On Mon, Feb 25, 2008 at 10:29 PM, Ian Hickson <ian at hixie.ch> wrote:

>    On Thu, 8 Feb 2007, Jorgen Horstink wrote:
>    > On Feb 8, 2007, at 9:00 PM, David Latapie wrote:
>    > > On Thu, 8 Feb 2007 19:17:32 +0000, Nicholas Shanks wrote:
>    > > > On 6 Feb 2007, at 07:57, Karl Dubost wrote:
>    > > >
>    > > > > > unlikely. "div" and "span" elements didn't exist in HTML+.
>    > > > >
>    > > > > http://www.w3.org/MarkUp/HTMLPlus/htmlplus_1.html
>    > > >
>    > > > Ironically I was just reading that earlier today, then saw your
>    > > > post! (I hadn't been reading this thread.)
>    > > >
>    > > > I wish the <image>fallback</image> tags had made it through the
>    > > > years. It's so much better than <img alt="blah"> and doesn't
suffer
>    > > > from the self-closing-tag-in-html problem.
>    > >
>    > > HTML 3.0 too had some great ideas. I'm still missing
>    > > - FN (but CSS3 has something about footnote that may fix this)
>    > > - LH (caption for list! A must-have)
>    >
>    > Why not using the title attribute?
>
>    Actually with <figure> the <lh> element is now better handled using
>    <figure> and <legend>.

Using <figure> and <legend>:
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cscript%3Edocument.createElement('figure')%3C%2Fscript%3E%3Ctitle%3ETitle%3C%2Ftitle%3E%3Cp%3E...%3C%2Fp%3E%0A%3Cfigure%3E%0A%20%20%3Clegend%3EList%20title%3C%2Flegend%3E%0A%20%20%3Cul%3E%0A%20%20%20%20%3Cli%3EList%20item%3C%2Fli%3E%0A%20%20%20%20%3Cli%3EList%20item%3C%2Fli%3E%0A%20%20%20%20%3Cli%3EList%20item%3C%2Fli%3E%0A%20%20%3C%2Ful%3E%0A%3C%2Ffigure%3E
While this isn't horrible, it isn't supported properly, as noted before.  FF
currently just ignores the fact that there's a <legend> tag at all and
treats the list title as a plain text node.  IE7 treats the <legend> as an
unknown tag and the title as a plain text node, even if you try to apply the
createElement shim.

Using <lh>:
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cscript%3Edocument.createElement('lh')%3C%2Fscript%3E%3Ctitle%3ETitle%3C%2Ftitle%3E%3Cp%3E...%3C%2Fp%3E%0A%20%20%3Cul%3E%0A%20%20%20%20%3Clh%3EList%20title%3C%2Flh%3E%0A%20%20%20%20%3Cli%3EList%20item%3C%2Fli%3E%0A%20%20%20%20%3Cli%3EList%20item%3C%2Fli%3E%0A%20%20%20%20%3Cli%3EList%20item%3C%2Fli%3E%0A%20%20%3C%2Ful%3E%0A
On the other hand, <lh> seems to be supported just fine in FF *and* IE7
(with the shim).  This solution is usable *immediately*, which is a big
plus.  Since we only want to allow a single header per list, though, I'd
prefer fully embracing the parallel with <table> and naming this element
<lhead>, thus implying it must come first and at most once.

At this point, though, why not just bend the definition of <ul> and <ol> and
allow <hx> tags directly?  Both FF and IE7 form good DOM trees with this
markup.
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cscript%3Edocument.createElement('lhead')%3C%2Fscript%3E%3Ctitle%3ETitle%3C%2Ftitle%3E%3Cp%3E...%3C%2Fp%3E%0D%0A%20%20%3Cul%3E%0D%0A%20%20%20%20%3Ch1%3EList%20title%3C%2Fh1%3E%0D%0A%20%20%20%20%3Cli%3EList%20item%3C%2Fli%3E%0D%0A%20%20%20%20%3Cli%3EList%20item%3C%2Fli%3E%0D%0A%20%20%20%20%3Cli%3EList%20item%3C%2Fli%3E%0D%0A%20%20%3C%2Ful%3E%0D%0A
This solution doesn't seem to have a drawback, really.  It's already
supported (*without* an IE shim), doesn't require the creation of a new
element, and is completely intuitive.  Just specify (like thead) that it
must be at the start of the list, and can occur at most once.

At this point, of course, one must wonder why we don't just stick with a
conforming idea and pop that <hx> into the first <li>.  Well, obviously,
this doesn't establish the appropriate semantics.  An <hx> *within* an <li>
is a header for the content *within* the <li>, not for the containing list.
Popping the header into the list directly as a first child would establish
this, while allowing you to effortlessly mess with the style via CSS
selectors (ul > * to give a uniform look to the contents, ul > hx to style
only list headers, etc.).  And, as noted, it's already handled uniformly and
appropriately in at least two major browsers, and there is no need to
introduce *another* new element for someone to learn.  All you need to do is
adjust the nesting rules for <ul> and <ol> slightly (and probably <dl> and
<dialog> as well), which only has an effect on validators.

I don't have the ability to check this in Opera and other browsers atm.
Anyone want to step up?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20080226/1cd0a7dd/attachment.htm>
Received on Tuesday, 26 February 2008 10:40:51 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:00 UTC