From f7135b81d8654ed23b670f053639614d914f5918 Mon Sep 17 00:00:00 2001 From: PJ Date: Tue, 18 Aug 2026 20:43:09 +0530 Subject: [PATCH] fix(spec): a boolean state selector names what the live element reports clickable, enabled, focused, checked and selected are derived from the element rather than written by the markup, so matching them as raw attributes built [clickable="true"] and reached nothing: the keys are accepted, no unknown-key error fires, and the worked example in docs/manual/spec-language.md found no element on web and passed having checked nothing. Each key is answered by the same function elementHandle derives the fact with, since no CSS says what any of them says: :focus names the shadow host of a focused field as well, :checked misses a checked custom element and answers for a selected option besides, and [checked] is the state the page loaded with rather than the one the user left it in. --- pkg/spec/src/web-runtime.ts | 160 +++++++++++++++++++++--------- pkg/spec/test/web-dom-harness.ts | 5 + pkg/spec/test/web-runtime.test.ts | 94 ++++++++++++++++++ 3 files changed, 212 insertions(+), 47 deletions(-) diff --git a/pkg/spec/src/web-runtime.ts b/pkg/spec/src/web-runtime.ts index b705e42..1cddb0a 100644 --- a/pkg/spec/src/web-runtime.ts +++ b/pkg/spec/src/web-runtime.ts @@ -143,6 +143,49 @@ function secureSelector(value: string): string { return `:is(input${textInput}, textarea, [contenteditable]:not([contenteditable="false"]))`; } +// The other five boolean states are derived from the live element too, and +// matching them as an attribute reached nothing at all: `[clickable="true"]` is +// a match no page carries, the key is accepted so no unknown-key error fires, +// and a spec naming a control that way, as the worked example in +// docs/manual/spec-language.md does, finds none and passes having checked +// nothing. They are answered against the element rather than compiled into CSS +// because no CSS says what any of them says: `:focus` names the shadow HOST of a +// focused field as well, and never the field Compose keeps behind its caret, +// `:checked` misses a checked custom element and answers for a selected