[whatwg] Definition of alt= attribute

Alexey Feldgendler alexey at feldgendler.ru
Thu Jan 19 02:04:45 PST 2006


On Wed, 18 Jan 2006 18:43:42 +0600, Matthew Paul Thomas  
<mpt at myrealbox.com> wrote:

> In HTML 4 alt= is an attribute for <img>, <applet>, and <input>. I can  
> think of no reason for <input alt= to exist (<form alt= would make  
> slightly more sense, for non-interactive UAs), and Web Applications 1.0  
> currently includes an "applets" HTMLCollection but no <applet> element,  
> so I've tweaked the text to refer to <img> elements exclusively. If  
> <applet> is introduced, alt= should be put in a "Common attributes"  
> section, and occurrences of "image" changed to "item".
>
> <li><p>Do not provide alternate text for an image when it is used for  
> formatting, decoration, illustration, or linking to a solely graphical  
> resource. Instead, use <code>alt=""</code>. For example, a portrait of  
> someone should usually have <code>alt=""</code>, unless either their  
> physical appearance or the artwork itself is highly relevant and not  
> described elsewhere in the document.</p></li>
> </ul>

I wonder why alt is a required attribute for IMG in HTML while an empty  
value is allowed. There are several arguments for making it optional:

1. Many authors still don't specify alt or specify alt="" just to make the  
page validate. There's not much sense in requiring an alt when there is a  
way to not specify it (alt=""), though it is a spec violation.

2. Empty attributes aren't very XPath friendly (actually, XPath isn't well  
equipped to work with empty attributes).

3. If other elements, such as APPLET, also get the alt attribute, it would  
have to be optional to maintain backward compatibility. It would be  
inconsistent to require alt for IMG and have it optional for APPLET.

Basing on the above points, I propose to relax the requirements and  
defined alt as an optional attribute.


-- 
Opera M2 8.5 on Debian Linux 2.6.12-1-k7
* Origin: X-Man's Station [ICQ: 115226275] <alexey at feldgendler.ru>



More information about the whatwg mailing list