fix(spec): keep a secure selector valid beside another key

a multi-key object selector concatenates its parts into one compound,
and a type selector is valid only at the head of one, so {id, secure}
built '[id="pwd"]input[type="password"]' and querySelectorAll threw.
This commit is contained in:
pj committed 2026-08-18 20:16:03 +05:30
1 parent c8d52cb7d5
commit e2f9864201
2 files changed
+46 -1

No files matched your search

+6 -1
View File
@@ -129,8 +129,13 @@ const KNOWN_KEY_TO_CSS: Record<string, (value: string) => string> = {
// call editable, so false is every editable field that is NOT a password entry
// rather than everything that is not one: an element that is no field reports
// null, as android reports null for everything, and answers to neither value.
//
// Both arms are wrapped in `:is()` because a multi-key selector concatenates the
// parts into one compound, where a type selector is valid only at the head:
// `{id, secure}` built `[id="pwd"]input[type="password"]`, which is a parse
// error, and querySelectorAll throws rather than answering with nothing.
function secureSelector(value: string): string {
if (value === "true") return `input[type="password"]`;
if (value === "true") return `:is(input[type="password"])`;
if (value !== "false") return ":not(*)";
const textInput = ["password", ...NON_TEXT_INPUT_TYPES]
.map((type) => `:not([type="${type}"])`)