Allow more characters in element/attribute names and prefixes
Categories
(Core :: DOM: Core & HTML, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox149 | --- | fixed |
People
(Reporter: d, Assigned: sideshowbarker)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete, webcompat:platform-bug)
Attachments
(1 file)
See spec changes at https://github.com/whatwg/dom/pull/1079 for:
- createAttribute()
- setAttribute()
- toggleAttribute()
- createElement()
- createElementNS()
- createDocument()
- createAttributeNS()
- setAttributeNS()
and https://github.com/whatwg/html/pull/7991 for updates to "valid custom element name" which impacts:
- customElements.define()
- customElements.whenDefined()
- Whether elements are HTMLElement or HTMLUnknownElement ( https://html.spec.whatwg.org/#elements-in-the-dom:valid-custom-element-name )
| Reporter | ||
Comment 1•9 months ago
|
||
We found one more instance, the dataset named property setter: https://github.com/whatwg/html/pull/11453
Updated•9 months ago
|
| Assignee | ||
Comment 2•4 months ago
|
||
Implement “relaxed” element/attribute name-validation rules, per:
- https://github.com/whatwg/dom/pull/1079
- https://github.com/whatwg/html/pull/7991
- https://github.com/whatwg/html/pull/11453
That aligns DOM-API name behavior with HTML parser behavior — which has
always allowed a wider range of characters in element and attribute names.
New validation functions in nsContentUtils:
- IsValidElementLocalName(): For createElement — allows [A-Za-z] start followed by
any char except null/whitespace/>//, or [:_>=0x80] start with restricted continuation - IsValidAttributeName(): For setAttribute/toggleAttribute/createAttribute —
no null, whitespace, /, >, or = - IsValidNamespacePrefix(): For *NS methods — no null, whitespace, /, or >
- IsValidDoctypeName(): For createDocumentType — no null, whitespace, or >
- ParseQualifiedNameRelaxed(): Validates and parses qualified names with relaxed rules
ParseQualifiedNameRelaxed() correctly implements the "strictly split" algorithm
per the DOM spec: for qualified names with multiple colons like "f:o:o", the
local name is just the second token ("o"), not everything after the first colon
("o:o"). This matches the spec's requirement to split on all colons and use only
splitResult[0] as prefix and splitResult[1] as localName.
Deleted outdated DOM Level 1 mochitest tests that tested old XML-based name
validation rules; WPT name-validation.html provides coverage for the new
relaxed rules. Removed WPT expected-failure .ini files, since all tests now pass.
Updated•4 months ago
|
Comment 5•3 months ago
|
||
Backed out for causing failures at Document-createElement.html.
Backout link: https://hg-edge.mozilla.org/integration/autoland/rev/ffbf2e75d4f856f99b6bb4a9bc5a84d4dff9bf73
Updated•2 months ago
|
Comment 8•2 months ago
|
||
Revert for causing mochitest-plain failures on test_createAttributeNS03.html.
Updated•2 months ago
|
| Assignee | ||
Updated•2 months ago
|
Comment 10•2 months ago
|
||
| bugherder | ||
Updated•2 months ago
|
Comment 11•2 months ago
|
||
FF149 Docs work for this can be tracked in https://github.com/mdn/content/issues/43218
Description
•