From 94149db07389aea5b44c3881666f52936a19b630 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Thu, 15 Feb 2024 14:43:44 -0700 Subject: [PATCH] LibWeb: Implement Document named properties with light caching We now cache potentially named elements on the Document when elements are inserted and removed. This allows us to do lookup of what names are supported much faster than if we had to iterate the tree every time. This first cut doesn't implement the rules for 'exposed' object and embed elements. --- .../DOM/Document-named-properties.txt | 16 ++ .../input/DOM/Document-named-properties.html | 45 ++++ Userland/Libraries/LibWeb/DOM/Document.cpp | 201 +++++++++++++++++- Userland/Libraries/LibWeb/DOM/Document.h | 14 +- Userland/Libraries/LibWeb/DOM/Document.idl | 3 +- Userland/Libraries/LibWeb/DOM/Element.cpp | 14 +- 6 files changed, 285 insertions(+), 8 deletions(-) create mode 100644 Tests/LibWeb/Text/expected/DOM/Document-named-properties.txt create mode 100644 Tests/LibWeb/Text/input/DOM/Document-named-properties.html diff --git a/Tests/LibWeb/Text/expected/DOM/Document-named-properties.txt b/Tests/LibWeb/Text/expected/DOM/Document-named-properties.txt new file mode 100644 index 0000000000..a60439f549 --- /dev/null +++ b/Tests/LibWeb/Text/expected/DOM/Document-named-properties.txt @@ -0,0 +1,16 @@ + Submit
+document.bob === document.forms[0]: true +