RE: Adaptive Image Element Proposal

John Foliot, Fri, 31 Aug 2012 14:07:58 -0700:

> Since, as the quip goes, a picture is worth a thousand words, I fear 
> that we might start seeing something like this:
> 
> <picture> 
>  Painting: The Scream by Edvard Munch. 
   ……   1000 words snipped   ……
> <img alt="Painting: The Scream by Edvard Munch">
> </picture>

There is one unrealistic thing about your example, and that is that the 
fallback contains no mark-up: No <p> tags and no other structuring 
elements either.

In the case of the alt attribute, then, what keeps authors within 
limits, is the "natural" limitations of an attribute: It is 
inconvenient to type long texts inside attribute. Especially if you are 
using a WYSIWYG editor. And, more important, the author cannot spot any 
structure - whether in code or in visual formatting - since there are 
no tags or other visual formatting structure inside the text of an 
attribute.

It is definitely possible to to make it more convenient to author 
fallback for the <picture> element - and thus there is a risk for 
longer texts. However, keep in mind, that with the <canvas> model (and 
it is the same all the new HTML5 elements with fallback), there is a 
"natural limitation". Consider this example:

<p>Paragraph with picture:
   <picture>
      <p>
         1000 words goes here
      </p>
   </picture>
</p>

The resulting DOM of the above code, would be roughly this:

<p>
   Paragraph with picture:
   <picture>
   </picture>
</p>
<p>
   1000 words goes here
</p>

Thus, the nested paragraph would be moved out the parent picture 
element.

Whether this happens or not, depends on the parent element of the 
<picture> element - <picture> will contain its content if the parser 
permits the parent element to keep the same content. (The spec 
describes this a peculiarity of the HTML5 parser.)  

So, in order to stay on the safe side, in all contexts, authors would 
need to limit themselves to inline elements. Or, eventually, the 
WYSIWYG would need to sensitive to the parent element and only offer 
authors to enter content is permitted in the parent element. It is less 
tempting to enter 1000 words if you have to stay within the visual 
limitations of inline/phrasing elements, than it is if you have access 
to the formatting elements to write a thesis.

(Though I did know this well, still, as I was writing some private 
tests tonight, using the canvas element, I took myself in erring in 
this detail several times - I could not fathom why the fallback became 
visible ...)
-- 
leif halvard silli

Received on Saturday, 1 September 2012 20:03:25 UTC