This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17868 - Lists should permit interleaved structuring
Summary: Lists should permit interleaved structuring
Status: RESOLVED NEEDSINFO
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-18 07:09 UTC by contributor
Modified: 2012-12-29 17:23 UTC (History)
6 users (show)

See Also:


Attachments

Description contributor 2012-07-18 07:09:03 UTC
This was was cloned from bug 17030 as part of operation convergence.
Originally filed: 2012-05-10 14:26:00 +0000
Original reporter: Francis Davey <bugzilla@francisdavey.co.uk>

================================================================================
 #0   Francis Davey                                   2012-05-10 14:26:26 +0000 
--------------------------------------------------------------------------------
It is common for lawyers to use numbered lists extensively, for example in contracts and statutes. It is good style, and logical, to be able to group parts of such a document using some form of document structuring and to give parts of the document headings.

Doing this job properly in html is, at the moment, not possible if one wishes to obey the DTD: <ol> may only have <li> as children.

I write a lot of website terms and conditions and I would like to use HTML more widely as a source document for legal works. I am unhappy at having to adopt hacks to achieve this or to change, what seems to me a useful semantics for no good reason. 

I would not be surprised if this kind of interleaving was not also desirable in other contexts.

I suggest it would be useful to be able to markup numbering in a way that would allow at least headings and possible other structuring such as <section> to be interleaved with that numbering. To that end, could the <h?> tags <hgroup> and <section> be allowed as children of <ol>?

I realise there are hacks that would allow this. They are all quite ugly and in some cases rather awkward. I can also see no good reason for the restriction.
================================================================================
 #1   theimp@iinet.net.au                             2012-07-05 02:53:44 +0000 
--------------------------------------------------------------------------------
Originally, <ol> meant Ordered List, not Numbered List. User Agents had to convey order somehow, which could have been anything from numbering, to using an ever-larger font for higher-value items, to inserting the text "Ordered List" before the list block.

The principle is that <ol> and <ul> are one-dimensional; the "numbering" of <ol> list items is as meaningless as the bullets against <ul> list items. If the numbers mean something, it's content, which makes it inappropriate for a one-dimensions list, and should be specified another way. Otherwise, it's presentation, and should be specified with eg. stylesheets.

In practice, people mostly decided that <ol> specifically implied numbering, which brought the above assumption into collision with the expectation that numbering should be content that they can control.

So, implementation of the advanced CSS solution ( http://www.w3.org/TR/css3-lists/ ) has been idle for almost a decade, while conversely, every implementor has dome something different to each other (See for example Bug 14548).

And then there's the accessibility concerns which transcend HTML/browsers (see for example Bug 13668)

This conflict of content/structure/presentation has also made other messes. See for example Bug 17632 and Bug 17633. It seems that it's no longer possible to treat ordered lists specifically as being only structural, only presentational, or only content. All three concepts must be implemented consistently with each other for predictable results. HTML5 does not intend to address this decisively.

And this has all made it extremely difficult to properly mark up things like legal documents, where, for example, "Section 1A" *must* have the number "1A" in all user agents and under all circumstances. Difficult to the point that the usual solution is to not use semantic markup, and just have a big plain text dump.

---

Now, as for a solution to the issue you've mentioned specifically, try using the DL/DT/DD structure, where you have a list where the numbering is critical.

Something like:

<style>
dl {
background-color: #0000ff;
}
dt {
display: inline;
float: left;
width: 3em;
margin-right: 1em;
text-align: right;
background-color: #ff0000;
}
dd {
background-color: #00ff00;
margin-left: 4em;
}
dt:after {
content: ".";
}
</style>
<dl>
<dt>abc</dt>
<dd> def ghi</dd>
</dl>

The benefit of this is made even better for things like legal documents, where complex markup (such as <span> or <abbr>) can be used within the "list marker" (dt). You can have sublevels (nest more DLs within DTs), and individual styles, and so on. Be careful with completely unnumbered (ie. empty) entries, though; it's syntactically legal, but semantically problematic.

In any case; don't use <ol> anywhere that the numbering itself is vital (then it's content; use <dl> or <table>). This is true now and will remain true after HTML5 is standardized.
================================================================================
Comment 1 Ian 'Hixie' Hickson 2012-09-27 23:44:19 UTC
Francis, could you elaborate on the kind of document you have in mind here?
Comment 2 Ian 'Hixie' Hickson 2012-12-29 17:23:11 UTC
If this refers to paragraphs in legal documents that each start with a number, I think that's actually just a sequence of paragraphs with explicit numbers in the text, not a nested list. At least, that's how it seems to usually be presented. But without more information, I don't know what to do here.