Re: href within <area> is supposed to be optional

Michael[tm] Smith wrote:
> Antonio Zamora <antonio_zamora@verizon.net>, 2011-08-11 18:45 -0400:
> 
>> The HTML validator gives the following error for an <area> element which has
>> no href=
>>
>> Validation Output: 1 Error
>>    Error Line 93, Column 23: Element area is missing required attribute
>> href.
> 
> The only circumstance in which the validator would emit that message is
> when the area element also has an alt attribute, in which case the error
> message is correct, because the spec doesn't allow alt to be specified on
> area elements unless the href attribute is also specified.
> 
>   http://dev.w3.org/html5/spec/the-map-element.html#attr-area-alt
> 
>   "If the area element has an href attribute, then the area element
>    represents a hyperlink. In this case, the alt attribute must be
>    present... If the area element has no href attribute, then the area
>    represented by the element cannot be selected, and the alt attribute
>    must be omitted."

Surely, from the very text that you have cited (and from your own
paraphrase of it), the omission of an "href" attribute from an <area>
element should generate an error message of the form "Element area has
disallowed attribute alt" rather than the message that it currently emits.
The error is not the omission of the "href", it is the inclusion of the "alt".

Philip Taylor

Received on Friday, 12 August 2011 14:13:45 UTC