summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-05-23 11:25:07 +0200
committerAndreas Kling <kling@serenityos.org>2023-05-23 14:38:45 +0200
commitdf1bb0ff49b0f52f61da8d19c46cdbfa4ef6cfeb (patch)
tree52a603c17f4d11c2cc31ae00d4f6bd20a3752674 /Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
parente31f696ee631f8dac610f8011d859098f439ea33 (diff)
downloadserenity-df1bb0ff49b0f52f61da8d19c46cdbfa4ef6cfeb.zip
LibWeb: Make HTMLCollection faster when it only cares about children
Some of the live HTMLCollection only ever contain children of their root node. When we know that's the case, we can avoid doing a full subtree traversal of all descendants and only visit children. This cuts the ECMA262 spec loading time by over 10 seconds. :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
index 1ebfe88206..aa81e2a713 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
@@ -244,7 +244,7 @@ static bool is_form_control(DOM::Element const& element)
JS::NonnullGCPtr<DOM::HTMLCollection> HTMLFormElement::elements() const
{
if (!m_elements) {
- m_elements = DOM::HTMLCollection::create(const_cast<HTMLFormElement&>(*this), [](Element const& element) {
+ m_elements = DOM::HTMLCollection::create(const_cast<HTMLFormElement&>(*this), DOM::HTMLCollection::Scope::Descendants, [](Element const& element) {
return is_form_control(element);
}).release_value_but_fixme_should_propagate_errors();
}