[uf-dev] Suggested new parsing rule for alt text

Brian Suda brian.suda at gmail.com
Fri Mar 23 03:47:42 PST 2007


On 3/22/07, Andy Mabbett <andy at pigsonthewing.org.uk> wrote:
>
> I suggest that this rule be adopted, for *all* microformats, unless
> there are good reasons for specific exceptions:
>
>          Where an element contains only an image element, and the parser
>          is expecting text, the alt text of the image should be used.
>
> For example:
>
>          <h1 class="fn org"><img src=logo.jpg" alt="Acme"></h1>
>
> should be equivalent of the currently-permissible:
>
>          <h1 class="fn org">Acme</h1>

--- i would disagree. If the author wants the ALT attribute of the IMG
element to be the FN value then there are two choices.
1) move the class="fn org" to the IMG element. THEN the ALT attribute
would be correctly used as the value
2) add a class="value" to the IMG element then the ALT attribute would
be picked-up by the parsers and used at the FN value.


> Can anyone foresee any problems with that?

--- plenty. This is an edge-case and leads to a slippery slop of LOTS
of what if's. What if there are 2 <img> elements? what if there is no
ALT element? what if it is an <object> element? what if it is an
<area>? What if the DOM updates the H1 at a later time, what about
sIFR, ...

If the author can already mark-up the <h1> element, how hard is it to
mark-up the <img>? the more complexity we layer into these parsing
rules for very little benefit, the more bugs, errors, problems we
introduce.

I don't see a significant advantage for just a small optimization,
which can cause more problems that it is worth.

-brian

-- 
brian suda
http://suda.co.uk


More information about the microformats-dev mailing list