W3C home > Mailing lists > Public > public-respimg@w3.org > September 2012

Re: Alt content [ was: “Adaptive Image Element Proposal”, now off HTML WG list ]

From: Anselm Hannemann <info@anselm-hannemann.com>
Date: Tue, 4 Sep 2012 23:26:16 +0200
To: Kornel Lesiński <kornel@geekhood.net>
Cc: public-respimg@w3.org
Message-ID: <399B9725E3514CD09DA84AEDC8E752AB@anselm-hannemann.com>
This sounds very good to me. It makes everything a fallback content  
when it's not an element or element-attribute and inside of the picture-element.

The advantage is clear: It works with and without <img>-element and it has no duplicates.

Cheers,
Anselm  

Am Dienstag, 4. September 2012 um 22:13 schrieb Kornel Lesiński:  
> On Thu, 30 Aug 2012 20:10:54 +0100, Mathew Marquis <mat@matmarquis.com (mailto:mat@matmarquis.com)>  
> wrote:
>  
> > What I’d like to do here is get your thoughts, as authors, on the  
> > following:
> >  
> > 1) Duplicating the `alt` attribute on both `picture` and the fallback  
> > `img`
> > 2) `alt` specified on fallback `img`, using `aria-labelledby` on  
> > `picture` to reference the ID of the fallback `img`
> >  
>  
>  
> I think there's a third option missing:
>  
> 3) Don't duplicate the `alt` attribute, reuse fallback in a smart way.
>  
> Simply don't use `alt` on <picture> at all. Require UAs to read all  
> content of <picture> (including content of <img alt>) when alternative  
> text is required.
>  
>  
> <picture><img alt="fallback text"></picture>
>  
> <picture><img alt="fallback"> text</picture>
>  
> <picture>fallback <img alt="text"></picture>
>  
> <picture>fallback text</picture>
>  
> In all examples above the alt would be identical: read as "fallback text".  
> And it would be read basically the same way by <picture>-supporting HTML5  
> UAs as HTML4 UAs.
>  
>  
> The algorithm for extracting alt this way is quite simple. In jQuery  
> notation would be:
>  
> $('picture source').remove() // ignore <source>, keep rest of the content
>  
> $('picture img').each(function(){
> $(this).replace(document.createTextNode(this.alt)) // Replace <img  
> alt="foo"> with "foo"
> })
>  
> var alt = $('picture').text() // take all text remaining in  
> <picture>here</picture>
>  
>  
> --  
> regards, Kornel
>  
>  
Received on Tuesday, 4 September 2012 21:26:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 4 September 2012 21:26:40 GMT