FF149 Allow more characters in DOM APIs#29217
Conversation
|
Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs). |
| "relax_dom_valid_names": { | ||
| "__compat": { | ||
| "description": "Allow more characters in custom element names", |
There was a problem hiding this comment.
I used this key and name here. We could instead do something like this. Is really a question "is the key and description reasonable".
| "relax_dom_valid_names": { | |
| "__compat": { | |
| "description": "Allow more characters in custom element names", | |
| "dom_names_match_html_parser": { | |
| "__compat": { | |
| "description": "Characters in custom element names match those allowed by HTML parser", |
There was a problem hiding this comment.
cc @ddbeck for thoughts on naming this spec evolution subfeature.
There was a problem hiding this comment.
@hamishwillee can you give me an example of a name that would be invalid under the old spec and valid under the new spec? I think this would help me understand to best frame this subfeature.
There was a problem hiding this comment.
@ddbeck My perspective is the main benefit is that the character set allowed by HTML and DOM now match for namespace, element, and attribute names.
To answer your question, from the spec issue what I saw as likely most significant was allowing emoticons in names - so this is now valid my-🎉-element but would have been blocked by XML.
From Claude, a summary of the main differences including some tags that are now valid that were not before.
| Name | Old (XML) | New (WHATWG) | Why significant |
|---|---|---|---|
my!element |
❌ InvalidCharacterError | ✅ valid | ! now allowed after letter start |
my?tag |
❌ | ✅ | ? now allowed |
my(tag) |
❌ | ✅ | (, ) now allowed |
my🎉tag |
❌ | ✅ | Emoji/post-Unicode-2.0 characters |
tag=value (element) |
❌ | ✅ | = allowed in element names |
_tag! |
❌ | ❌ | ! still blocked after non-letter start |
my tag |
❌ | ❌ | Whitespace always blocked |
my>tag |
❌ | ❌ | > always blocked |
| "relax_dom_valid_names": { | ||
| "__compat": { | ||
| "description": "Allow more characters in DOM names and namespaces", |
There was a problem hiding this comment.
Ditto for all these cases too
| "relax_dom_valid_names": { | |
| "__compat": { | |
| "description": "Allow more characters in DOM names and namespaces", | |
| "dom_names_match_html_parser": { | |
| "__compat": { | |
| "description": "DOM names and namespace characters match HTML parser", |
| "relax_dom_valid_names": { | ||
| "__compat": { | ||
| "description": "Allow more characters in custom element names", | ||
| "spec_url": "https://dom.spec.whatwg.org/#namespaces", |
There was a problem hiding this comment.
Note, was getting lint error on missing spec. I have made all these point to the section on name validation.
FF149 adds support for additional characters to be allowed in attribute and element names in https://bugzilla.mozilla.org/show_bug.cgi?id=1773312.
Previously you could only use the chars allowed in XML names - now the rules are less restrictive to allow the same chars as the HTML parser.
Spec update: whatwg/html#7991
Chrome states support in 143:
Webkit added support in https://bugs.webkit.org/show_bug.cgi?id=241419 but I don't think this made it to Safari yet.
Related docs work can be tracked in mdn/content#43218