[whatwg] [html5] Numbering things other than <li>

Matthew Thomas mpt at myrealbox.com
Sat Jan 8 02:00:05 PST 2005


On 8 Jan, 2005, at 3:47 AM, Ian Hickson wrote:
> ...
<http://www.whatwg.org/specs/web-forms/current-work/#form-submission>
> ...
> Incidentally, the markup in this section suggests to me that Web
> Apps is going to need to do something to HTML to handle this better. 
> And suggestions?
> ...

Yes, people have lots of fun trying to find the correct markup for this 
situation. <http://simplebits.com/notebook/2004/04/20/sq.html>

The general problem is that people want to number (or, less commonly, 
bullet) series of items that are already in multi-element structures, 
such that <ol>/<ul> cannot be used. Here, if numbering were not 
required, you would arguably be using <dl> (since each section is a 
full definition of the instruction given in its first line), but <dt>s 
can't be numbered automatically solely with HTML. The same applies to a 
formal dictionary where definitions <dd> for each term should be 
numbered. And the same applies to a table where each row <tr> should be 
numbered.

You could use CSS counters, but that's a presentation answer to a 
content problem; the numbers are vital information even when CSS is 
unavailable or disabled. Similarly, it is occasionally necessary to 
start from a number other than 1 (so as to quote only some clauses from 
a statute, for example), and/or to change the list numbering partway 
through (so as to omit step 2 from a business plan, for example), just 
like you can with <ol>, without inserting CSS into your markup. (And 
yes, the only browser to support CSS counters is Opera -- but that 
itself isn't a fair argument against using them, since immediate 
support for any newly-invented markup would be even worse.)

I was going to suggest listtype= and liststart= attributes, to be 
applied to any element (e.g. <tbody>) whose children you want treated 
as a list, along with a listvalue= attribute for altering numbering of 
children within the list itself. But then I realized that wouldn't work 
for <dd>, because the container(s) surrounding a definition term or 
terms, and the definition datum or data, are never explicit.

Then I was going to suggest a <list> element, with the same attributes 
as <ol>, and the difference that it can be placed around any elements 
you want treated as a list. But putting that around every set of <dd>s 
in a <dl> would still be annoying.

So, um, I don't know. Perhaps listtype=, liststart=, listfor=, and 
listresetafter=? For example, <dl listfor="dd" listresetafter="dt" 
listtype="a">.

-- 
Matthew Thomas
http://mpt.net.nz/




More information about the whatwg mailing list