Re: what is dt?

On Fri, Sep 18, 2009 at 1:15 PM, Leif Halvard Silli
<> wrote:
> Tab Atkins Jr. On 09-09-18 16.58:
>> 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:
>> <figure>
>>  <p caption>Exhibit A</p>
>>  <h1>Madonna and child</h1>
>>  <img src="foo" alt="bar">
>> </figure>
> As Lachlan said, one disadvantage to this would be that it would be
> impossible to place the caption /last/. Unless you also add a special rule
> for last child ...

Huh?  I'm not sure how this applies.  Lachlan's objection was to using
the first <h1> child as the caption, as the content might want to have
an <h1> child as well.  That's not a problem here - there's absolutely
no reason to have a [caption] at the top-level of the content (it
would have to be in a nested <figure>, and there's no ambiguity

In other words, the following is perfectly fine, and doesn't require
the author to change their markup specially to avoid bad effects:

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

The <p> could even go in the middle I guess, though that would be very
odd and I wouldn't recommend it.

Also, just in case it wasn't clear, the intention is that @caption can
be put on *any* child of <figure>.  It's not just for <p>.  You can
put it on <ul>, <div>, or whatever.  The intended rendering (stolen
from another suggestion from Lachy) can be expressed as:

figure { display: table; }
figure>[caption] { display: table-caption; caption-side: bottom;
margin: 0; text-align: center; }
figure>[caption]:first-child { caption-side: top; }

> Also, if you can accept <figure caption >, then why not <dl figure >
> instead?

I don't understand the connection.  <figure> doesn't get @caption.
Some child of it does.  The intent is basically identical to that of
<time pubdate> - rather than minting a new element just to indicate
that something has a particular semantic relation to its
parent/ancestor, you just pop an attribute on it.

This approach isn't infinitely scaleable, of course - it's been stated
before that basing actual behavior/parsing/etc on attributes is a big
antipattern that is to be avoided at nearly all costs.  But as long as
the relation conveys nothing more than a bit of semantics, it should
be okay, just like <time pubdate> does.  (This would mean that
<details> should probably keep using actual elements, so <dt>/<dd>
seems fine there.)

<dl figure> is something different entirely - it's changing the
semantics of the element entirely, rather than adding additional
semantics like <* caption>.  It also just feels weird; to me, it's
probably *weirder* than <figure><dt/><dd/></figure>.


Received on Friday, 18 September 2009 18:52:10 UTC