[html5] the case for a <dli> element

Ian Hickson ian at hixie.ch
Tue Oct 15 14:54:30 PDT 2013


On Sun, 30 Dec 2012, Brian Tremblay wrote:
>
> I'm using <dl> markup for a restaurant menu, and have added product 
> microdata markup from schema.org. Because items in a <dl> are defined 
> implicitly -- <dt> element(s) followed by <dd> element(s) -- there's no 
> easy way to scope them individually. What I'm left doing is adding 2 id 
> attributes for each menu item, and using itemref:
> 
> http://tsmchughs.com/test/dessert

That's one way to do it, yeah.


> If we had a <dli> element, to scope each item in a description list, the 
> markup needed to add microdata (or microformats) would be much simpler. 
>
> [...]
> 
> Therefore, I think we need a <dli> element. This has come up in the 
> past. If I understand correctly, the editor has declined, saying that 
> the need for <dli> is only to make styling easier, so the problem should 
> be solved in css. But I think the problem here is not styling, it's 
> creating natural, discrete items in a description list, which might be 
> used for styling, or for microdata, or perhaps for other reasons which I 
> haven't thought of. Without <dli>, use of <dl> becomes much harder to 
> use even though it may be the best markup choice.

You're right that this is a much better reason for adding a <dl> grouping 
element.

Unfortunately, lack of use cases isn't the only reason we haven't added 
it. One of the other reasons is that it would require parser changes. For 
example, take this:

 <dl>
  <di>
   <dt>a
   <dd>b
  </di>
  <di>
   <dt>c
   <dd>d
  </di>
 </dl>

This looks like it should work, but right now it gets parsed as:

 <dl>
  <di>
   <dt>a</dt>
   <dd>b
    <di>
     <dt>c</dt>
     <dd>d</dd>
    </di>
   </dd>
  </di>
 </dl>

(Another reason is that it makes the processing model for <dl> more 
complicated for tools that want to process groups of items in <dl>s.)


Still, you make a very good point, that for microdata, the lack of 
grouping here is a more serious issue than styling-system limitations.

I guess it comes down to a question of how common microdata on <dl> groups 
is, vs how painful changing the parser and legacy tools would be. It's 
probably a close call (not much usage, but not a huge amount of pain).

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



More information about the Help mailing list