HREF attribute on A and AREA elements is not required

While using the <http://validator.w3.org/> service to check an HTML5
document ("<!DOCTYPE HTML>"), I encountered the following error message:

    Element area is missing required attribute href.

It is true that the <AREA> element in question does not have an "HREF"
tag; instead, it executes some Javascript with "ONCLICK".

However, by way of explanation, the validator refers me here:

http://dev.w3.org/html5/spec-author-view/links.html#attr-hyperlink-href

-- where it is quite clearly stated that "the href attribute on a and
area elements is not required; when those elements do not have href
attributes they do not create hyperlinks."

In other words, according to the HTML5 specification, this is not an
error.

I do not know if a similar error message would be produced in the case
of an <A> element without an HREF tag, nor what the situation would be
for HTML4.

Perhaps these issues should be investigated.

I'm not subscribed to this mailing list, so please CC my address for any
replies.


-- Ian Bruce

Received on Tuesday, 25 September 2012 05:24:04 UTC