Suggest making <dt> and <dd> valid in <ol>

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Suggest making <dt> and <dd> valid in <ol>

by Ian Yang :: Rate this Message:

| View Threaded | Show Only this Message

Hi chief editors and everyone else,

How have you been?

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. However, if using ordered list, usually the
approach is to use general heading (<H1>) and paragraph (<p>) to wrap the
term and the description. And that loses the meaning of "definition term"
and "definition description".

I was hesitant about using definition list or ordered list. Finally, I
chose ordered list, but felt uncomfortable about that.

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. Like the
following:

<ol>
    <li>
        <dt></dt>
        <dd></dd>
    </li>
    <li>
        <dt></dt>
        <dd></dd>
    </li>
    <li>
        <dt></dt>
        <dd></dd>
    </li>
</ol>


********************

And here comes another idea about the definition list (<dl>). By inspecting
the above code, <dt> and <dd>(s) could become more meaningful if they could
be grouped together by <li>. For example:

<dl>
    <li>
        <dt></dt>
        <dd></dd>
    </li>
    <li>
         <dt></dt>
         <dd></dd>
     </li>
    <li>
         <dt></dt>
         <dd></dd>
     </li>
</dl>

It's like the case of <label>s and <input>s in <form>.  Although it is
valid to just leave all <label>s and <input>s as directly children of <form>,
we often group them with <div>s (or <p>s) to make the markup more
meaningful and organized. And by doing so, we also get the side benefit of
having more styling elements.


********************

To sum up, it would be more meaningful if the following things become valid:

   - <dt> and <dd> are not restricted to <dl> only. They could also exist
   in <li> of <ol>
   - <dt> and <dd> in <dl> may, but not must, be grouped by <li> when in
   situations that using <li> to group them could make the markup more
   meaningful

And we surely don't need <dt> and <dd> in <ul> because using <dl> is more
appropriate.


Sincerely,
Ian Yang
Meaningful and semantic HTML lover  |  Front-end developer

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

by Anne van Kesteren-4 :: Rate this Message:

| View Threaded | Show Only this Message

On Sat, Jul 14, 2012 at 6:22 AM, Ian Yang <ian.html@...> wrote:
> 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.

I would recommend not over-thinking the matter. Otherwise soon you
will start wrapping your <p>s in <ol>/<li>s too to ensure they stay in
the correct order.

Using <dl> for ordered groups is perfectly fine.

(The specification points this out as well: "The order of the list of
groups, and of the names and values within each group, may be
significant.")


--
http://annevankesteren.nl/

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

by Jukka K. Korpela :: Rate this Message:

| View Threaded | Show Only this Message

2012-07-14 10:46, Anne van Kesteren wrote:

> On Sat, Jul 14, 2012 at 6:22 AM, Ian Yang <ian.html@...> wrote:
>> 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.
>
> I would recommend not over-thinking the matter. Otherwise soon you
> will start wrapping your <p>s in <ol>/<li>s too to ensure they stay in
> the correct order.

Indeed. The <ol> element is no more and no less ordered than <ul> or any
other element. Many HTML tag names are misleading.

> (The specification points this out as well: "The order of the list of
> groups, and of the names and values within each group, may be
> significant.")

That's actually a questionable statement there, since it may make the
read ask whether the order of sub-elements is *generally* significant.
It's as questionable as it would be to write "The order of successive p
elements may be significant" or "The order of successive section
elements may be significant".

Yucca



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

by Anne van Kesteren-4 :: Rate this Message:

| View Threaded | Show Only this Message

On Sat, Jul 14, 2012 at 9:34 AM, Jukka K. Korpela <jkorpela@...> wrote:

> 2012-07-14 10:46, Anne van Kesteren wrote:
>> (The specification points this out as well: "The order of the list of
>> groups, and of the names and values within each group, may be
>> significant.")
>
> That's actually a questionable statement there, since it may make the read[er]
> ask whether the order of sub-elements is *generally* significant. It's as
> questionable as it would be to write "The order of successive p elements may
> be significant" or "The order of successive section elements may be
> significant".

I believe it was added to the specification for the kind of question
that came up here. The "why do we have <ul> and <ol> but not <dl> and
<odl>?" question.


--
http://annevankesteren.nl/

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

by Ian Yang :: Rate this Message:

| View Threaded | Show Only this Message

2012/7/14 Anne van Kesteren <annevk@...>

> I would recommend not over-thinking the matter. Otherwise soon you
> will start wrapping your <p>s in <ol>/<li>s too to ensure they stay in
> the correct order.
>

That wouldn't be the problem. General <p>s of an article never are list
contents, so we surely won't wrap them in <ol>/<li>s.


> Using <dl> for ordered groups is perfectly fine.
>
> (The specification points this out as well: "The order of the list of
> groups, and of the names and values within each group, may be
> significant.")
>

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.

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.


Sincerely,
Ian Yang

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

by Ian Yang :: Rate this Message:

| View Threaded | Show Only this Message

2012/7/14 Jukka K. Korpela <jkorpela@...>

> Indeed. The <ol> element is no more and no less ordered than <ul> or any
> other element. Many HTML tag names are misleading.
>

That's interesting. If <ol> is no more and no less ordered than <ul>,
what's the purpose of its introduction? Could you provide detailed
explanations or examples? Thanks.


Sincerely,
Ian Yang

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

by Ian Yang :: Rate this Message:

| View Threaded | Show Only this Message

Okay, it seems that one of the ideas I mentioned in my original email needs
to be revamped.

I was saying that using general heading (<H1>) and paragraph (<p>) loses
the meaning of "definition term" and "definition description", but I didn't
realize that using <ol> loses the meaning of "definition list". That is,
the following code is, in fact, improper:

<!-- The following code is improper as it loses the meaning of "definition
list". -->
<ol>
    <li>
        <dt></dt>
        <dd></dd>
    </li>
    <li>
        <dt></dt>
        <dd></dd>
    </li>
    <li>
        <dt></dt>
        <dd></dd>
    </li>
</ol>


2012/7/14 Anne van Kesteren <annevk@...>

> I believe it was added to the specification for the kind of question
> that came up here. The "why do we have <ul> and <ol> but not <dl> and
> <odl>?" question.
>

That's a good idea. Thank you :)

********************

So based on the <ul> and the <ol>, we could have unordered definition list (
<udl>) and ordered definition list (<odl>).

When contents of a definition list are unordered, we could use:

<udl>
    <li>
        <dt></dt>
        <dd></dd>
    </li>
    <li>
         <dt></dt>
         <dd></dd>
     </li>
    <li>
         <dt></dt>
         <dd></dd>
     </li>
</udl>

And when contents of a definition list are ordered, we could use:

<odl>
    <li>
        <dt></dt>
        <dd></dd>
    </li>
    <li>
         <dt></dt>
         <dd></dd>
     </li>
    <li>
         <dt></dt>
         <dd></dd>
     </li>
</odl>


Sincerely,
Ian Yang

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

by Jukka K. Korpela :: Rate this Message:

| View Threaded | Show Only this Message

2012-07-14 18:51, Ian Yang wrote:

> If <ol> is no more and no less ordered than <ul>,
> what's the purpose of its introduction?

The real purposes, in the dawn of HTML, were that <ol> and <ul>
correspond to numbered and bulleted lists, respectively, reflecting two
very common concepts in word processors. This is how they have been
used, though some authors have started overusing <ul> for thinks like
lists of links even when they specifically don't want them to appear as
bulleted. Even W3C specifications, in their markup, switch to <ul> in
the midst of hierarchy when they want bullets and not numbers.

HTML5 tries to stick to the theoretical idea of "ordered" vs.
"unordered" list, but it does not really change anything, and it is not
supposed to change anything - any <ul> will still be rendered in the
order written.

More on this:
http://www.cs.tut.fi/~jkorpela/html/ul-ol.html

Yucca

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

by Ian Yang :: Rate this Message:

| View Threaded | Show Only this Message

2012/7/15 Jukka K. Korpela <jkorpela@...>

> 2012-07-14 18:51, Ian Yang wrote:
>
>  If <ol> is no more and no less ordered than <ul>,
>> what's the purpose of its introduction?
>>
>
> The real purposes, in the dawn of HTML, were that <ol> and <ul> correspond
> to numbered and bulleted lists, respectively, reflecting two very common
> concepts in word processors. This is how they have been used, though some
> authors have started overusing <ul> for thinks like lists of links even
> when they specifically don't want them to appear as bulleted. Even W3C
> specifications, in their markup, switch to <ul> in the midst of hierarchy
> when they want bullets and not numbers.
>
> HTML5 tries to stick to the theoretical idea of "ordered" vs. "unordered"
> list, but it does not really change anything, and it is not supposed to
> change anything - any <ul> will still be rendered in the order written.
>
> More on this:
> http://www.cs.tut.fi/~**jkorpela/html/ul-ol.html<http://www.cs.tut.fi/%7Ejkorpela/html/ul-ol.html>
>


Thanks. I'm not sure if I understand it correctly. I just couldn't find a
robust information from the article to proof that <ol> is no more and no
less ordered than <ul>.

Throughout the article, I saw it mentioned "bullets" and "numbers"
frequently. However, that's just browsers' default rendering of <ul> and
<ol>. As a coder, personally I don't care how browsers render them by
default. What I care is the meaning of the code I write. That is, when I
want an unordered list, I write <ul>; when I want an ordered list, I write
<ol>. <ul> means unordered list, and <ol> means ordered list. It's that
simple.

Although there may be some people misuse them (like the example mentioned
in the article), that's not <ul> and <ol>'s problem.

If I missed anything, please let me know. Thanks again.


Sincerely,
Ian Yang

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

by Jukka K. Korpela :: Rate this Message:

| View Threaded | Show Only this Message

2012-07-15 17:40, Ian Yang wrote:

 > Throughout the article, I saw it mentioned "bullets" and "numbers"
 > frequently. However, that's just browsers' default rendering of <ul> and
 > <ol>.

It's the only real difference between the two.

 > As a coder, personally I don't care how browsers render them by
 > default.

You should. Check out the Usual CSS Caveats.

 > What I care is the meaning of the code I write. That is, when I
 > want an unordered list, I write <ul>; when I want an ordered list, I
write
 > <ol>. <ul> means unordered list, and <ol> means ordered list.

And what does that mean? Does it mean that browser may or will treat
<ul> as unordered in the sense that it can render the items in any
order? If not, what *is* the difference? Just some people's *calling* it
"unordered".

Yucca


Parent Message unknown Re: Suggest making <dt> and <dd> valid in <ol>

by Leif Halvard Silli-4 :: Rate this Message:

| View Threaded | Show Only this Message

Sat, 14 Jul 2012 23:53:32 +0800, from Ian Yang

>Okay, it seems that one of the ideas I mentioned in my original email
> needs
to be revamped.
>
>I was saying that using general heading (<H1>) and paragraph (<p>) loses
the meaning of "definition term" and "definition description", but I didn't

>realize that using <ol> loses the meaning of "definition list". That is,
the following code is, in fact, improper:
>
><!-- The following code is improper as it loses the meaning of "definition
list". -->

><ol>
>    <li>
>        <dt></dt>
>        <dd></dd>
>    </li>
>    <li>
>        <dt></dt>
>        <dd></dd>
>    </li>
>    <li>
>        <dt></dt>
>        <dd></dd>
>    </li>
></ol>

An XOXO list should solve this:

http://microformats.org/wiki/xoxo#Properties_of_Outline_Items

Or just add a dl wrapper around the dt/dd elements in your code above.
--
Leif H Silli

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

by Ian Yang :: Rate this Message:

| View Threaded | Show Only this Message

2012/7/16 Jukka K. Korpela <jkorpela@...>

> 2012-07-15 17:40, Ian Yang wrote:
> > Throughout the article, I saw it mentioned "bullets" and "numbers"
> > frequently. However, that's just browsers' default rendering of <ul> and
> > <ol>.
>
> It's the only real difference between the two.


Sorry, I still don't get it. <ul> means unordered list; <ol> means ordered
list. They are quite different, aren't they?


> > As a coder, personally I don't care how browsers render them by
> > default.
>
> You should. Check out the Usual CSS Caveats.


Okay, actually I should say that browser's default rendering is not my *main
concern*.

I know browsers surely have their different default renderings of different
list elements to help readers distinguishing them. But as a coder, my *main
concern* is if the meaning of the code I write correspond the the content,
not the their default renderings (because browsers will handle that).

> What I care is the meaning of the code I write. That is, when I
> > want an unordered list, I write <ul>; when I want an ordered list, I
> write
> > <ol>. <ul> means unordered list, and <ol> means ordered list.
>
> And what does that mean? Does it mean that browser may or will treat <ul>
> as unordered in the sense that it can render the items in any order? If
> not, what *is* the difference? Just some people's *calling* it "unordered".
>

Imo, <ul> means the order of the items is unimportant, not browsers can
render the items in any order.

If there were a browser which wants to render the items of <ul> in any
order, okay, it may do that. Anyway, that's not my main concern.


Sincerely,
Ian Yang

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

by Ian Yang :: Rate this Message:

| View Threaded | Show Only this Message

2012/7/16 Leif H Silli <xn--mlform-iua@...>

> Sat, 14 Jul 2012 23:53:32 +0800, from Ian Yang
>
>> Okay, it seems that one of the ideas I mentioned in my original email
>> needs to be revamped.
>>
>
>> I was saying that using general heading (<H1>) and paragraph (<p>) loses
>> the meaning of "definition term" and "definition description", but I didn't
>> realize that using <ol> loses the meaning of "definition list". That is,
>> the following code is, in fact, improper:
>>
>
>> <!-- The following code is improper as it loses the meaning of
>> "definition list". -->
>>
> <ol>
>>    <li>
>>        <dt></dt>
>>        <dd></dd>
>>    </li>
>>    <li>
>>        <dt></dt>
>>        <dd></dd>
>>    </li>
>>    <li>
>>        <dt></dt>
>>        <dd></dd>
>>    </li>
>> </ol>
>>
>
> An XOXO list should solve this:
>
> http://microformats.org/wiki/**xoxo#Properties_of_Outline_**Items<http://microformats.org/wiki/xoxo#Properties_of_Outline_Items>
>
> Or just add a dl wrapper around the dt/dd elements in your code above.
>

Thanks for the useful information. I didn't know the XOXO thing before.

However, after reading the examples they provided, I still couldn't
understand its use. Could you please provide me with an example of the use
of XOXO, using the life cycle of the butterfly I mentioned above? Thank you
very much.


Sincerely,
Ian Yang

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

by Ian Hickson :: Rate this Message:

| View Threaded | Show Only this Message

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.


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


On Sat, 14 Jul 2012, Anne van Kesteren wrote:
>
> I would recommend not over-thinking the matter. Otherwise soon you will
> start wrapping your <p>s in <ol>/<li>s too to ensure they stay in the
> correct order.

True!


> Using <dl> for ordered groups is perfectly fine.
>
> (The specification points this out as well: "The order of the list of
> groups, and of the names and values within each group, may be
> significant.")

Indeed.


On Sat, 14 Jul 2012, Jukka K. Korpela wrote:
>
> Indeed. The <ol> element is no more and no less ordered than <ul> or any
> other element. Many HTML tag names are misleading.

It's certainly true that many element names are derived more from
historical accidents than their current semantics, but <ol> and <ul> are
semantically quite different, as the spec describes.

Specifically, <ol> implies that the order of the list cannot be changed
without affecting the meaning of the page, whereas the order in a <ul>
list is merely aesthetic.


> > (The specification points this out as well: "The order of the list of
> > groups, and of the names and values within each group, may be
> > significant.")
>
> That's actually a questionable statement there, since it may make the
> [reader] ask whether the order of sub-elements is *generally*
> significant.

That is a good question to ask oneself.


> It's as questionable as it would be to write "The order of successive p
> elements may be significant" or "The order of successive section
> elements may be significant".

They indeed _are_ significant. The spec doesn't mention this, though,
because it's blatently obvious and nobody in their right mind will
question it. :-)

With <dl>, we do get people asking whether it's ok to have the order
matter, so having an explicit statement in the spec allowing it is useful.
(Witness this very thread for such an example.)


On Sat, 14 Jul 2012, Ian Yang wrote:
>
> So based on the <ul> and the <ol>, we could have unordered definition
> list (<udl>) and ordered definition list (<odl>).

I don't really understand what problem this solves.


On Sat, 14 Jul 2012, Ian Yang wrote:
> 2012/7/14 Jukka K. Korpela <jkorpela@...>
> >
> > Indeed. The <ol> element is no more and no less ordered than <ul> or
> > any other element. Many HTML tag names are misleading.
>
> That's interesting. If <ol> is no more and no less ordered than <ul>,
> what's the purpose of its introduction? Could you provide detailed
> explanations or examples? Thanks.

Jukka is incorrect in his statement. The difference between <ol> and <ul>
is specifically that the order of elements in <ol> matters and the order
of elements in <ul> does not.

From the spec:

# The ol element represents a list of items, where the items have been
# intentionally ordered, such that changing the order would change the
# meaning of the document.

# The ul element represents a list of items, where the order of the items
# is not important -- that is, where changing the order would not
# materially change the meaning of the document.

There are examples in the two sections that illustrate the quite serious
semantic difference between the two.


On Sat, 14 Jul 2012, Jukka K. Korpela wrote:
>
> The real purposes, in the dawn of HTML, were that <ol> and <ul>
> correspond to numbered and bulleted lists, respectively, reflecting two
> very common concepts in word processors. This is how they have been
> used, though some authors have started overusing <ul> for thinks like
> lists of links even when they specifically don't want them to appear as
> bulleted.

Certainly that is, to a first approximation, a good way of thinking of the
difference between the two.

Of course, in many contexts there are no bullets or numbers, so this
simplification is not the whole story. For example, when reading a list,
even an unordered list, using speech synthesis, it may be useful for
navigation purposes to have all lists be numbered. This does not mean
there is no difference between <ul> and <ol>, as the examples in the spec
illustrate.


> Even W3C specifications, in their markup, switch to <ul> in the midst of
> hierarchy when they want bullets and not numbers.

W3C specifications are hardly what I would refer to as the epitome of good
Web design, so I'm not sure I'd draw any conclusions from that!


> HTML5 tries to stick to the theoretical idea of "ordered" vs.
> "unordered" list, but it does not really change anything, and it is not
> supposed to change anything - any <ul> will still be rendered in the
> order written.

Not necessarily. That depends on the UA.


> More on this:
> http://www.cs.tut.fi/~jkorpela/html/ul-ol.html

The example in that document, from the old HTML4 specification, is a
perfect example of incorrect usage of <ul>.

In general, I would recommend referring to the contemporary specification
for more precise information on the elements' semantics and usage.


On Sun, 15 Jul 2012, Jukka K. Korpela wrote:
> 2012-07-15 17:40, Ian Yang wrote:
> >
> > As a coder, personally I don't care how browsers render them by
> > default.
>
> You should. Check out the Usual CSS Caveats.

On the contrary. Ian is correct to rely on the meaning of the language
rather than its default rendering in one user agent or another.


On Mon, 16 Jul 2012, Ian Yang wrote:
>
> Sorry, I still don't get it. <ul> means unordered list; <ol> means
> ordered list. They are quite different, aren't they?

They are indeed quite different.


> Imo, <ul> means the order of the items is unimportant, not browsers can
> render the items in any order.
>
> If there were a browser which wants to render the items of <ul> in any
> order, okay, it may do that. Anyway, that's not my main concern.

That is an appropriate use of HTML. :-)


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?

--
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

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

by Jukka K. Korpela :: Rate this Message:

| View Threaded | Show Only this Message

2012-07-16 5:36, Ian Yang wrote:

> Imo, <ul> means the order of the items is unimportant, not browsers can
> render the items in any order.

But if the order is unimportant, there still _is_ an order. Being
unordered would be something else. And what would it matter to indicate
the order as important if you only do that in markup, without affecting
rendering, search engines, etc., at all? It's like invisible ink in a
book. If it is somehow relevant to say that the order is unimportant,
you have to, well, *say* it (in words).

The only reason for this "unordered" list idea (a list is by definition
unordered; a set, or a multiset, is not) is the willingness to keep <ul>
and <ol> in HTML (it would be very impractical to omit one of them)
without admitting that they were introduced, and are being used, simply
for bulleted and numbered lists. So this resembles the confusing play
with words regarding <i> and <b>.

Yucca



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

by Ian Yang :: Rate this Message:

| View Threaded | Show Only this Message

2012/7/16 Ian Hickson <ian@...>

> 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

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

by Ian Yang :: Rate this Message:

| View Threaded | Show Only this Message

2012/7/16 Jukka K. Korpela <jkorpela@...>

> 2012-07-16 5:36, Ian Yang wrote:
>
>> Imo, <ul> means the order of the items is unimportant, not browsers can
>> render the items in any order.
>>
>
> But if the order is unimportant, there still _is_ an order. Being
> unordered would be something else.


The "order" you are referring to here is just the sequence of writing <li>(s)
into the <ul>. That's not the actual meaning of the order of list items and
is unimportant.


And what would it matter to indicate the order as important if you only do
> that in markup, without affecting rendering, search engines, etc., at all?
> It's like invisible ink in a book. If it is somehow relevant to say that
> the order is unimportant, you have to, well, *say* it (in words).
>

Because as a coder, my main concern is whether the meaning of the code I
write is correct or not. If the order is unimportant, I write <ul>, and my
job is done. As for default browser rendering, search engines, etc ...
That's not my main concern.



> The only reason for this "unordered" list idea (a list is by definition
> unordered; a set, or a multiset, is not) is the willingness to keep <ul>
> and <ol> in HTML (it would be very impractical to omit one of them) without
> admitting that they were introduced, and are being used, simply for
> bulleted and numbered lists. So this resembles the confusing play with
> words regarding <i> and <b>.
>

At first, maybe they were introduced and misused by some people because of
their default renderings. They anyway possess meanings in their names. And
nowadays they are used by their meanings instead of their default rendering.

But your opinion does remind me of the <small> element. That element is a
perfect example of introducing and using an element simply for its
rendering. Unlike <ul> and <ol>, it's not meaningfully named at all.
Honestly, I'm not a huge fan of recycling a deprecated element. If we need
an element for side comments, we could introduce <comment> or <c>. If we
need an element for document info, we could introduce <info>. That would
make HTML elements more meaningfully named.


Sincerely,
Ian Yang

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

by Ian Hickson :: Rate this Message:

| View Threaded | Show Only this Message

On Mon, 16 Jul 2012, Jukka K. Korpela wrote:
> 2012-07-16 5:36, Ian Yang wrote:
> >
> > Imo, <ul> means the order of the items is unimportant, not browsers
> > can render the items in any order.
>
> But if the order is unimportant, there still _is_ an order.

The specification even mentions that the order can be specific and
intentional; e.g. alphabetical. The spec doesn't say that there is no
order, merely that the order is not important.


> Being unordered would be something else.

Something essentially impossible in the linear medium that is digital
content. :-)


> And what would it matter to indicate the order as important if you only
> do that in markup, without affecting rendering, search engines, etc., at
> all?

It can affect search engines. In particular, for example, Google will
extract items from lists in Web pages and display them in the search
engine results snippets. If the list's order is unimportant, it can
reorder the items to give the most relevant ones first. If the order _is_
important, it might make more sense for it to only show the first few.


> The only reason for this "unordered" list idea (a list is by definition
> unordered; a set, or a multiset, is not) is the willingness to keep <ul>
> and <ol> in HTML (it would be very impractical to omit one of them)
> without admitting that they were introduced, and are being used, simply
> for bulleted and numbered lists. So this resembles the confusing play
> with words regarding <i> and <b>.

No, these are quite different. The <i> and <b> that were introduced in the
contemporary version of the spec have entirely different semantics as the
obsolete ones from the HTML4 days. They were only introduced after strong
use cases were presented, and they happen to use the same element names
because that allows us to leverage existing implementations. In the case
of <ul> and <ol> they were kept more or less as defined in HTML4 (though
with better wording and examples). To be honest I don't think we ever
really studied whether or not they should be included; given their broad
use and relatively minimal negatives, there was no reason to.

--
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Parent Message unknown Re: Suggest making <dt> and <dd> valid in <ol>

by Ian Yang-2 :: Rate this Message:

| View Threaded | Show Only this Message

From previous discussions, some people had suggested possible markup for
"life cycle" type contents. And personally I will stick to using <dl> until
there is a better solution.

There is still one thing left unanswered. And that's whether we will be
able to put <li> inside <dl>.

Let's consider <form> we used often. When coding a form, none of us make it
like the following one because that's obviously very ugly and, most
importantly, it hurts our eyes!

<form method="post" action="/">
    <label for="name">Name</label>
    <input id="name" type="text">
    <label for="email">Email</label>
    <input id="email" type="email">
    <label for="site">Website</label>
    <input id="site" type="url">
    <label for="phone">Phone</label>
    <input id="phone" type="tel">
    <input id="male" type="radio">
    <label for="male">Male</label>
    <input id="female" type="radio">
    <label for="female">Female</label>
    <label for="msg">Message</label>
    <textarea id="msg"></textarea>
</form>

Instead, we use <div> (some people use <p>) to group sub elements to make
them more organized, and we also get the side benefit of having more
elements for styling:

<form method="post" action="/">
    <div>
        <label for="name">Name</label>
        <input id="name" type="text">
    </div>
    <div>
        <label for="email">Email</label>
        <input id="email" type="email">
    </div>
    <div>
        <label for="site">Website</label>
        <input id="site" type="url">
    </div>
    <div>
        <label for="phone">Phone</label>
        <input id="phone" type="tel">
    </div>
    <div>
        <input id="male" type="radio">
        <label for="male">Male</label>
    </div>
    <div>
        <input id="female" type="radio">
        <label for="female">Female</label>
    </div>
    <div>
        <label for="msg">Message</label>
        <textarea id="msg"></textarea>
    </div>
</form>


Like above examples, the following <dl> is not well organized, and it's
also a pain to read it:

<dl>
    <dt>Lorem Ipsum</dt>
    <dd>Sit amet, consectetur adipiscing elit.</dd>
    <dt>Aliquam Viverra</dt>
    <dd>Fringilla nulla nunc enim nibh, commodo sed cursus in.</dd>
    <dt>Pretium Et Nibh</dt>
    <dd>Quisque porttitor mauris ut velit tincidunt ut hendrerit erat
mollis.</dd>
    <dd>A dui condimentum suscipit. Quisque tortor nulla.</dd>
    <dt>Tempus Et Augue</dt>
    <dd>Vivamus ipsum massa, tristique tempus lobortis a.</dd>
    <dt>Vivamus Semper Convallis</dt>
    <dt>Cras Eget Eros</dt>
    <dd>Pellentesque. Vestibulum volutpat mollis placerat.</dd>
    <dd>Maecenas eu tempus ut, imperdiet eu tortor.</dd>
    <dt>Pellentesque</dt>
    <dd>Lobortis consequat ipsum id pulvinar.</dd>
    <dt>Nibh Purus</dt>
    <dd>Adipiscing sit amet ultrices quis, consequat eu dolor.</dd>
</dl>

If developers could, *optionally*, use <li> to wrap each group, the code
would be more organized:

<dl>
    <li>
        <dt>Lorem Ipsum</dt>
        <dd>Sit amet, consectetur adipiscing elit.</dd>
    </li>
    <li>
        <dt>Aliquam Viverra</dt>
        <dd>Fringilla nulla nunc enim nibh, commodo sed cursus in.</dd>
    </li>
    <li>
        <dt>Pretium Et Nibh</dt>
        <dd>Quisque porttitor mauris ut velit tincidunt ut hendrerit erat
mollis.</dd>
        <dd>A dui condimentum suscipit. Quisque tortor nulla.</dd>
    </li>
    <li>
        <dt>Tempus Et Augue</dt>
        <dd>Vivamus ipsum massa, tristique tempus lobortis a.</dd>
    </li>
    <li>
        <dt>Vivamus Semper Convallis</dt>
        <dt>Cras Eget Eros</dt>
        <dd>Pellentesque. Vestibulum volutpat mollis placerat.</dd>
        <dd>Maecenas eu tempus ut, imperdiet eu tortor.</dd>
    </li>
    <li>
        <dt>Pellentesque</dt>
        <dd>Lobortis consequat ipsum id pulvinar.</dd>
    </li>
    <li>
        <dt>Nibh Purus</dt>
        <dd>Adipiscing sit amet ultrices quis, consequat eu dolor.</dd>
    </li>
</dl>

And usually "life cycle" type contents are presented as circles. Without
<li>(s), it will be hard to style them.

Since the *optional *use of <li> in <dl> could solve many problems, may we
have <li> being valid in <dl>?


Sincerely,
Ian Yang

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

by Alex Bishop :: Rate this Message:

| View Threaded | Show Only this Message

On 19/07/2012 08:04, Ian Yang wrote:
> Since the *optional *use of <li> in <dl> could solve many problems, may we
> have <li> being valid in <dl>?

Probably not, as it has similar drawbacks as the proposed <di> element:

http://wiki.whatwg.org/wiki/FAQ#HTML_should_group_.3Cdt.3Es_and_.3Cdd.3Es_together_in_.3Cdi.3Es.21

Alex

--
Alex Bishop
alexbishop@...
< Prev | 1 - 2 | Next >