1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:57:44 +00:00

LibWeb: Implement named property access AOs on Window

These allow accessing embeds, forms, images and objects with a given
name attribute, and any element with a given id attribute, as top level
properties on the global object.

It also allows accessing NavigableContainers by target name as top level
properties on the global object.

The current implementation feels very expensive. It's likely that
these values will need smarter caching in the future.
This commit is contained in:
Andrew Kaster 2023-09-19 16:40:42 -06:00 committed by Andrew Kaster
parent 247f12d7b0
commit 5949e3c3e8
4 changed files with 164 additions and 2 deletions

View file

@ -209,6 +209,12 @@ private:
void invoke_idle_callbacks();
struct [[nodiscard]] NamedObjects {
Vector<JS::NonnullGCPtr<Navigable>> navigables;
Vector<JS::NonnullGCPtr<DOM::Element>> elements;
};
NamedObjects named_objects(StringView name);
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
JS::GCPtr<DOM::Document> m_associated_document;