From d829470ab780e7eed3d915f9d8766c5a6a6550c8 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Tue, 17 Nov 2026 20:21:04 -0600 Subject: [PATCH] Support live named access in WPT Window fixtures --- packages/ui/wpt.config.ts | 21 +++++++ packages/web-platform-tests/README.md | 11 ++++ .../src/node/named-properties.ts | 61 +++++++++++++++++++ packages/web-platform-tests/src/node/run.ts | 4 ++ 4 files changed, 97 insertions(+) create mode 100644 packages/web-platform-tests/src/node/named-properties.ts diff --git a/packages/ui/wpt.config.ts b/packages/ui/wpt.config.ts index 39b28ee..90cec07 100644 --- a/packages/ui/wpt.config.ts +++ b/packages/ui/wpt.config.ts @@ -184,6 +184,27 @@ const config: WPTConfig = { 'Calling insertBefore with a reference child whose parent is not the context node must throw a NotFoundError.', 'Inserting a node before itself should not move the node', ], + 'html/browsers/the-window-object/named-access-on-the-window-object/basics.html': [ + 'A named property must return an element as-is if its name attribute matches', + 'A named property must not be set if the element is not reachable from the Document', + 'A named property must not be enumerable', + 'A named property must return any element for which the id attribute matches', + 'A non element node in the document should not cause errors', + // Multiple matches require live HTMLCollection support. + ], + 'html/browsers/the-window-object/named-access-on-the-window-object/changing.html': true, + 'html/browsers/the-window-object/named-access-on-the-window-object/removing.html': true, + 'html/browsers/the-window-object/named-access-on-the-window-object/existing-prop.html': true, + 'html/browsers/the-window-object/named-access-on-the-window-object/name-attribute-elements.html': + [ + 'Only elements with specific local names may be returned if their name attribute matches (negative test)', + 'Removing an element for which the name attribute is not tracked, must not cause errors upon removing it', + // The positive case requires a live HTMLCollection. + ], + 'html/browsers/the-window-object/named-access-on-the-window-object/id-non-html-elements.html': [ + 'Parsed svg and math elements with an id are exposed', + // Other cases require append() or live HTMLCollection support. + ], }, exclude: { '**': true }, }; diff --git a/packages/web-platform-tests/README.md b/packages/web-platform-tests/README.md index ae26964..67bdcbc 100644 --- a/packages/web-platform-tests/README.md +++ b/packages/web-platform-tests/README.md @@ -129,6 +129,17 @@ Window event delegation currently requires extensible event objects. Unsupported source features fail explicitly. Selecting part of a file does not claim coverage of its remaining subtests or complete standards conformance. +Window named access resolves a single element by its nonempty `id`, or an HTML +`embed`, `form`, `img`, or `object` by its nonempty `name`. Lookup follows the +associated document's current tree, so insertion, removal, and attribute changes +take effect immediately. Existing globals and inherited properties take priority; +assignments shadow named access, and names are not enumerated. The worker installs +this lookup in its global prototype chain and restores that chain during cleanup. +Multiple matching elements and child browsing-context names fail explicitly: +live `HTMLCollection` results and iframe windows are not implemented. An iframe's +`id` can still expose the element itself. Window prototype descriptors and the +full named-properties object are outside this fixture's supported scope. + Parsed `