Re: OT: img Element, alt Attribute

Dustin wrote:
> On 8/17/05, David Woolley <david@djwhome.demon.co.uk> wrote:
>>
>>><img src="enter.gif">
>>
>>As well as being off topic, that's not valid HTML!

It's not valid HTML 4, but it's valid HTML 3.2 where alt is defined as 
#IMPLIED, not #REQUIRED.

> How is that not valid HTML?  If you mean the @alt attribute or the @longdesc 
> attribute is missing, it isn't valid due to accessibility reasons. 

The HTML 4 DTDs specify that the alt attribute is required for img 
elements (longdesc is optional) and a document that does not comply with 
the rules expressed in the DTD is not valid.

> Accessibility is mandatory in some countries, but in others, it is not.

Although omitting the alt attribute does cause accessibility problems, 
you're confusing accessibility with validity.  Validity has nothing to 
do with accessibility, and even less to do with the author's country of 
origin.

> Even if you don't have one or both of those attributes, it is still considered 
> standard-compliant code,

No, invalid code is not standards compliant.

> depending on your location in the world and your 
> personal coding preferences. If you omit them, most user-agents will not 
> stop rendering the page (and/or the image).

Now you're confusing validity with the XML concept of well-formedness. 
While an ill-formed document is not valid and XML UAs must stop 
processing upon encountering such errors, an invalid document can still 
be well-formed and a UA will not stop processing a document just because 
it is invalid.  This applies even less to HTML and SGML, for which error 
handling is not well defined at all.

> The image will still be rendered usually, regardless of whether the
> tag's contents consist of the image's  path.

User Agent behaviour also has nothing to do with validity.

-- 
Lachlan Hunt
http://lachy.id.au/

Received on Thursday, 18 August 2005 05:33:07 UTC