diff --git a/pkg/spec/src/web-runtime.ts b/pkg/spec/src/web-runtime.ts index e355bc1..5e5dcc6 100644 --- a/pkg/spec/src/web-runtime.ts +++ b/pkg/spec/src/web-runtime.ts @@ -359,6 +359,38 @@ function evaluateXPathAll(xpath: string, root: Node): Element[] { return out; } +// rawAttributes keys an element's attributes by the names the markup writes, +// which is what `attrs` means on every other backend. element.dataset would key +// `data-cents` as `cents`, so a spec reading attrs["data-cents"] the way the +// native hosts report it read undefined on web and every assertion over it +// passed vacuously. +function rawAttributes(element: Element): Record { + const out: Record = {}; + for (const attribute of Array.from(element.attributes ?? [])) { + out[attribute.name] = attribute.value; + } + return out; +} + +// fieldHint names an editable field the way a user reads it, in the order the +// accessible name is computed: its own aria-label, the