Re: what is dt?

On Fri, Sep 18, 2009 at 9:33 AM, Lachlan Hunt <> wrote:
> Tab Atkins Jr. wrote:
>> On Thu, Sep 17, 2009 at 7:51 PM, Leif Halvard Silli
>> <>  wrote:
>>> To illustrate my point, we could end up with this:
>>> <figure>
>>> <h1>Exhibit A</h1>
>>> <div><h1>Madonna and child</h1>
>>> <img src="foo" alt="bar">
>>> </div>
>>> </figure>
>> It's easy to avoid that situation - the caption for the<figure>  would
>> just be the *first* child heading element.  So it wouldn't be
>> necessary to wrap a<div>  around the content there - the second<h1>
>> is implicitly part of the content, not the caption.
> Let's try to avoid introducing solutions that require such workarounds to
> avoid unintended side affects.  Also, requiring the caption to be the first
> element is counter intuitive for the very common practice of putting
> captions below images or other figure content.

This is true.  In that case, though, we're definitely stuck with
explicitly marking the caption and the content in such a way that the
caption *cannot* be confused as part of the content.

As noted before, <dt>/<dd> works, in that they can't show up as
arbitrary children.  A new element would work, if it was defined as
the caption of a <figure>.

A third solution (that was actually suggested by you, Lachlan,
yesterday in IRC) is to use an attribute to disambiguate the caption
from the content.  So you'd have markup like:

  <p caption>Exhibit A</p>
  <h1>Madonna and child</h1>
  <img src="foo" alt="bar">

This would mark the <p> as being the caption for the <figure>.  This
has some definite benefits.  For one, it lets you use any markup
whatsoever as the caption, without need for a special wrapper; you
could, frex, have <ul caption> appearing in a <figure>.  For two, it
lets us use the best word for the job without legacy concerns, since
attributes live in a different namespace than elements.

In specific terms, the first child of a <figure> with [caption] would
be the caption for that figure.  If there is no such child, the figure
has no caption.  If a [caption] appears on an element that is *not* a
direct child of a <figure>, the attribute is simply ignored (*NOT*
promoted up as the caption for the nearest ancestor <figure> - I'd
prefer to keep this useful for new elements in the future without the
same issues that are preventing us from using <caption>).

This could similarly work for <details>, I suppose.  (Though, like I
said, I have much less problem with <dt>/<dd> in <details>, for
multiple reasons.)


Received on Friday, 18 September 2009 14:59:02 UTC