W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2012

Re: [whatwg] Suggest making <dt> and <dd> valid in <ol>

From: Ian Yang <ian.html@gmail.com>
Date: Mon, 16 Jul 2012 15:02:42 +0800
Message-ID: <CAFhBhuPzdWXKpQW8KanKdVxkCV_6FvQcZo=y4hR5BRSZM-oSig@mail.gmail.com>
To: whatwg@lists.whatwg.org
2012/7/16 Ian Hickson <ian@hixie.ch>

> On Sat, 14 Jul 2012, Ian Yang wrote:
> > Recently I was involved in a project. One of its pages has a special
> > content which is like a "life cycle". There are several stages in the
> > cycle, each stage has a term followed by some text describing the term.
> > Let's take the life cycle of butterfly for example:
> >
> > Egg
> > A white egg.
> >
> > Caterpillar
> > The egg hatches into a caterpillar. The caterpillar eats and grows a
> > tremendous amount.
> >
> > Pupa
> > The caterpillar forms a hard outer shell. Inside the shell, the
> caterpillar
> > changes into a butterfly.
> >
> > Butterfly
> > Butterflies live for only a short time. They will fly, mate, and
> reproduce.
> > The female lays an egg that was fertilized by the male.
> >
> > By seeing such contents, we usually code it using definition list
> > (<dl>). At first, I was thinking the same idea. But then I realized that
> > stages in a life cycle should be regarded as ordered contents. So
> > ordered list (<ol>) would be more appropriate.
>
> <ol> and <dl> would both be fine here. I'd probably go with <ol>, because
> it's a list of states, each of which has a name, rather than a list of
> names, but both are reasonable.
>
> With <ol>, I'd probably write:
>
>    <ol>
>     <li><dfn>Egg</dfn>: A white egg.
>     <li><dfn>Caterpillar</dfn>: The egg hatches...
>
> ...and so on.
>

Thanks. That use looks fine, yet I'm a bit confused now. What's the
difference between *using definition list (<dl>)* and *using ordered list (
<ol>) with <dfn> inside of it*? And how could we determine when to use
which?


> If we could make <dt> and <dd> being not restricted to <dl> only, but
> > could also exist in <ol>, the problem will be solved perfectly.
>
> It's not clear that there's a problem to be solved. :-)
>
> (Also, there are parsing issues that make changing this area of the spec
> be rather fraught with peril.)
>

Yeah, I had gave up that idea as it loses the meaning "definition list".



On Sat, 14 Jul 2012, Ian Yang wrote:
> >
> > Thanks for the info about the spec saying in <dl> the order of the list
>
> > of groups *may* be significant. However, what it says means a <dl>
> > itself is unable to tell whether its contents are unordered or ordered,
> > and we have to judge that by ourselves.
>
> Well, what it means is that a user agent can't randomly reorder a <dl>'s
> contents, as that would violate the rule that its rendering must
> faithfully represent the page's semantics. (The spec relies on this in
> several places to mark up English-prose equivalents of "switch statements"
> in its algorithms, for example.)
>
>
> > Comparing to <ul> and <ol> which themselves are able to tell whether
> > their contents are unordered and ordered, the <dl> itself being unable
> > to do that is, imho, disappointing.
>
> It's something we could add, but it's not clear that there's a compelling
> need for it. What is the use case for knowing that a <dl>'s contents can
> be arbitrarily reordered?
>

Well, I'm not sure if "user agent can't randomly reorder its contents"
equals to "the order of its content is important". If it does, some use
cases of <dl> such as FAQ may became incorrect as the order of contents of
FAQ is usually unimportant.


Sincerely,
Ian Yang
Received on Monday, 16 July 2012 07:03:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:09 GMT