Repository navigation
Every built-in element is :defined - #193
Merged
Merged
Conversation
jdalton
force-pushed
the
fix/defined-built-ins
branch
2 times, most recently
from
September 5, 2026 02:48
e50f059 to
bb2ea11
Compare
Collaborator
Author
|
This one sits with #190 and #191 and #192, which touch the conformance fixes found by comparing against Chromium. They do not depend on each other. All seventeen in the series cherry-pick onto master in any order, and I checked that in both directions, so any one of these can land alone. The order below is the one they read best in: |
This was referenced Sep 5, 2026
jdalton
force-pushed
the
fix/defined-built-ins
branch
from
September 6, 2026 02:30
bb2ea11 to
ae6aada
Compare
':defined' asks the custom element registry about the candidate's tag name and requires an instanceof match, so it matches upgraded custom elements and nothing else. Every built-in element is defined; only a custom element can be undefined, and only until a definition exists and it has been upgraded. Browsers read it off the element's custom element state, where uncustomized and custom are the two that count as defined. https://github.com/chromium/chromium/blob/155.0.8041.1/third_party/blink/renderer/core/dom/element.h#L1201 The test reads the hyphen in the name first, which is what makes a name a custom element name, and asks for the 'is' attribute only when there is none, so an ordinary element costs one string scan. References: - Spec: https://dom.spec.whatwg.org/#concept-element-defined — uncustomized and custom are the two states that count as defined - Spec: https://html.spec.whatwg.org/#custom-elements-core-concepts — what makes a name a custom element name - Chromium: https://github.com/chromium/chromium/blob/155.0.8041.1/third_party/blink/renderer/core/dom/element.h#L1201 — the state read, with the same spec link in its own comment - Chromium: https://github.com/chromium/chromium/blob/155.0.8041.1/third_party/blink/renderer/core/css/selector_checker.cc#L3139 — ':defined' is that and nothing else - MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/:defined
jdalton
force-pushed
the
fix/defined-built-ins
branch
from
September 6, 2026 11:40
ae6aada to
6b2375a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
Match built-in HTML, SVG, and MathML elements with :defined. Use native custom-element state when available, with a registry fallback for hosts that cannot provide it. Keep native-matcher reentry guarded.
Tests
Focused tests cover ordinary elements, autonomous custom elements, customized built-ins, upgrades, cached queries, and native state after is-attribute changes. A Chromium test compares results before and after install().
413 Node tests and all 43 WPT pages pass. Type checks, lint, and the Chromium comparison pass. Combined coverage passes every unchanged threshold.