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

Ian Hickson ian at hixie.ch
Thu Aug 21 01:57:47 PDT 2008


On Tue, 26 Feb 2008, Tab Atkins Jr. wrote:
> >    > > - 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.

It's true that <legend> has support problems, but these are fixable on the 
long run (indeed the HTML parser requires that they be fixed, so either 
this will eventually work, or we'll have to fix the parser and can revisit 
this then). Adding a new element here is something I really want to avoid 
because we already have half a dozen different ways to mark up titles, 
captions, legends, labels, titles, and the like, and adding more just 
seems silly.


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

This would address the problem for <ol> and <ul>, but wouldn't solve the 
problem for all markup. The <figure> solution is more generic.

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