[check 7] ALT text can't be empty (null or all spaces) if image is used as an anchor

Original message froward from Andrew Kirkpatrick below:
Regarding check #7:
http://checker.atrc.utoronto.ca/servlet/ShowCheck?check=7&lang=eng
----


I do wonder if it is better to separate this out a little.  All anchors need
text in one form or another.  It doesn't matter if the text is in alt or
straight text, just so long as it exists.  Perhaps a check: Anchor text
can't be empty.  This would cover <a href="#content"></a> as well as missing
alt text in anchors.

Once this is covered, all you need to worry about with images is the
validity and then the common "bad alt" checks.

If a testing tool finds:
<a href="somewhere"><img src="rex.jpg" alt=""/></a>

It should flag two errors:
1) anchor text empty (definite error)
2) missing alt text (possible error)

I'd like the missing alt text to be a positive error, but am not sure how
that will work.

AWK


This should be ok:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>OAC Testfile - Check #7 - Positive</title>
</head>
<body>
<a href="somewhere"><img src="rex.jpg" alt=""/>Rex</a>
</body>
</html>


This should be ok:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>OAC Testfile - Check #7 - Positive</title>
</head>
<body>
<a href="somewhere"><img src="rex.jpg" alt=""/><img src="rex.jpg"
alt="Rex"/></a>
</body>
</html>


This should be ok (there are better examples, but you get the point here):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>OAC Testfile - Check #7 - Positive</title>
</head>
<body>
<a href="somewhere"><img src="rex.jpg" alt="Rex"/><img src="rex.jpg"
alt="the cat"/></a>
</body>
</html>

Received on Monday, 29 March 2004 10:37:46 UTC