usemap-references-map
Per the HTML Living Standard, the usemap attribute on an <img> element "must be a valid hash-name reference to a map element" — a # followed by a string that exactly matches the name attribute of a <map> element in the same tree.
Matching is by name, not id, so no-refer-to-non-existent-id — which only tracks id references — never catches a missing or misspelled usemap target. This rule fills that gap.
A file that is a part of a page (a component of a framework, or an HTML file without a document type and an html element) is not checked, as the file that completes it may hold the target. A whole document (<!doctype html><html>, or a file that parserOptions.documentMode declares document) is.
❌ Examples of incorrect code for this rule
<img src="shapes.png" alt="" usemap="#nonexistent" />
✅ Examples of correct code for this rule
<img src="shapes.png" alt="" usemap="#shapes" />
<map name="shapes">
<area shape="rect" coords="25,25,125,125" href="red.html" alt="Red box." />
</map>
Interface
{
"usemap-references-map": boolean
}
Require that an img element's usemap attribute is a valid hash-name reference to a map element.
Default Severity
error