[whatwg] The IMG element, proposing a CAPTION attribute

I want to revisit something I've said earlier, so basically I'll be  
replying to myself.

Le 10 nov. 2006 ? 21:19, Michel Fortin a ?crit :

> Le 10 nov. 2006 ? 19:16, Ian Hickson a ?crit :
>
>> The difference is that <caption> will never work, because of  
>> things like
>> this:
>>
>>    <table>
>>      <caption>
>>         <figure>
>>            <img ...>
>>            <caption> ...A... </caption>
>>         </figure>
>>      </caption>
>>      ...
>>    </table>
>>
>> ...which, for legacy compatibility reasons, must result in a DOM  
>> where the
>> text with "A" ends up in a second <caption> element that is a  
>> child of the
>> <table> element.
>
> I don't get it. Are you saying that <caption> cannot work outside  
> <table> because it has to work a certain way when inside a <table>  
> element? Or are you simply saying that <figure> cannot work because  
> it cannot work inside a table caption?

I think Ian's example was a bad one to demonstrate his point,  
although his point is probably more valid that I first thought. It's  
just silly to put a figure in a table caption; instead, he should  
have given me this one:

     <table>
       <tr><td>
          <figure>
             <img ...>
             <caption> ...A... </caption>
          </figure>
       </td></tr>
     </table>

where the figure is in a table cell. This example, when viewed in a  
browser, will move the figure caption as the caption for the  
enclosing table. What this means is that you could take a perfectly  
fine document, move its content to a table cell (because of some  
silly table layout) and -- poof! -- all the figure captions move at  
the top of containing table (as table caption). Although I don't  
encourage table-based layout, I think this is a real deal breaker if  
we want a figure element that gets used.

So what to do? It has been proposed that <legend> be used. I still  
don't like much this option, in part because <legend> is already used  
for the title of user interface elements and I'd like to keep UI  
elements separate from document content elements, in other part  
because it's likely to be styled differently than other legends.

So I propose a new <fcaption> elements -- for "figure caption" -- in  
replacement for the <caption> element in my previous figure construct:

     <figure>
       <fcaption>Caption Text</fcaption>
       <img src="...">
     </figure>

And if I were to propose a default styling for this, it'd be this one:

     figure { display: table; }
     fcaption { display: table-caption; }


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/

Received on Wednesday, 22 November 2006 06:42:11 UTC