mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 13:35:00 +00:00
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. :^)
This commit is contained in:
parent
e31f696ee6
commit
df1bb0ff49
10 changed files with 54 additions and 41 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue