[uf-new] img alt content (was:hAudio implemented on Bitmunk (with one snag))

Manu Sporny msporny at digitalbazaar.com
Mon Jul 9 19:30:38 PDT 2007


Andy Mabbett wrote:
> My argument is that the fn should /not/ be empty; the "alt" attribute
> contains the text equivalent of the image. To discount it as you suggest
> is to ignore the semantics of the mark-up presented to you.

I believe Andy and Scott are referring to Section 13.2 of the HTML 4.01
specification:

http://www.w3.org/TR/html4/struct/objects.html#h-13.2

  alt         %Text;         #REQUIRED -- short description --

and Section 13.8 of the HTML 4.01 specification:

http://www.w3.org/TR/html4/struct/objects.html#h-13.8

Specifically, the sections that state the following concerning alternate
text for images:

    * Do not specify irrelevant alternate text when including images
intended to format a page, for instance, alt="red ball" would be
inappropriate for an image that adds a red ball for decorating a heading
or paragraph. In such cases, the alternate text should be the empty
string (""). Authors are in any case advised to avoid using images to
format pages; style sheets should be used instead.
    * Do not specify meaningless alternate text (e.g., "dummy text").
Not only will this frustrate users, it will slow down user agents that
must convert text to speech or braille output.

I think Andy and Scott have the correct approach to this problem. All
one must do is view the following in a text-based browser, such as
Lynx... or in Firefox/Opera/etc and the answer becomes much clearer:

<html>
 <head>
  <title>Test of link with image with alt text</title>
 </head>
 <body>
  Here's a link with an image with alt test:
  <a href="http://www.microformats.org">
   <img src="uf.png" alt="Microformat" /> It!
  </a>
 </body>
</html>

The text that is displayed as a link in Lynx is   : "Microformat It!"
The text that is displayed as a link in Firefox is: "Microformat It!"

Mike, would it be possible to write a parseTagTextFromImages() function
that would extract the 'alt' text from images? Therefore, running it
over the following HTML:

  <a class="fn url" href="http://www.mikekaply.com/">
   <img src="uf.png" alt="Michael" /> Kaply
  </a>

Would yield the text "Michael Kaply" for 'fn'. Using this approach would
also solve the hAudio problem as well as the problems that have been
raised thus far in this thread.

-- manu



More information about the microformats-new mailing list