demo · v143

Attribute name permissivity

The same loosening applies to attribute names. Type any attribute name (UTF-8, punctuation, dashes anywhere) and watch setAttribute, getAttribute, and the parser's own behaviour come into alignment in Chrome 143.

Pre-v143, setAttribute("data:role", "x") threw — but parsed HTML containing the same attribute was happily accepted and surfaced in the DOM.

Live tester

setAttribute()

—

parser via innerHTML

—

Resulting outerHTML

What it checks

  1. Creates an element of the chosen tag.
  2. Calls el.setAttribute(name, value) in a try/catch.
  3. Builds a parallel element by writing a literal HTML string to innerHTML and reading the resulting attribute back.
  4. Reports whether the two paths agree. With v143 they should match — anything HTML5 parses, setAttribute now accepts.
const el = document.createElement("div");
el.setAttribute("data:role", "hero");   // Chrome <143: InvalidCharacterError
                                        // Chrome  143+: works

see also