Re: Comments on Image maps in HTML5, coordinate and possible validator issues

"Michael E. Ewing owner, Graphic Information Sciences" <admin@gisone.com>, 2012-07-11 08:00 +0000:

> Sample code:
> (this validates in 4.01 transitional, but not in HTML5):
> 
> <MAP NAME="Map1">
> <AREA SHAPE="RECT" COORDS="25, 206, 90, 228" HREF="index.htm" alt="Our Home Page">
> .. . .
> 
> (This validates in HTML5 and in 4.01 transitional:)

The only reason it validates in the HTML4 validator is that the HTML4
validator doesn't actually check the value of the coords attribute at all.
It'll accept any value you put there -- e.g., coords="foo + bar / baz".
Try it.

The HTML4 spec doesn't actually unambiguously state the precise
requirements on the value of coords. What it does have is here:

  http://www.w3.org/TR/html401/struct/objects.html#h-13.6.1

But there it does describe it as "comma-separated list of lengths", with no
mention of spaces being allowed in the list.

> <MAP NAME="Map1">
> <AREA SHAPE="RECT" COORDS="25,206,90,228" HREF="index.htm" alt="Our Home Page">
> .. . .

The HTML5 spec requires the value of coords to be a "valid list of
integers", which it defines clearly as:

  http://www.w3.org/TR/html5/common-microsyntaxes.html#valid-list-of-integers
  "A valid list of integers is a number of valid integers separated by
  U+002C COMMA characters, with no other characters (e.g. no space
  characters)."

So you can't have spaces in the value.

> The HTML5 validator identifies the error with the phrase "expecting a
> digit or "-" sign", which isn't very helpful in figuring out what is
> wrong.

Yeah the error message for this case should be improved; I've filed a
validator bug and will try to make time to fix it.

  http://bugzilla.validator.nu/show_bug.cgi?id=934

  --Mike

-- 
Michael[tm] Smith http://people.w3.org/mike

Received on Thursday, 19 July 2012 09:39:32 UTC