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