1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

LibWeb: Don't allocate NamedNodeMap in Element constructor

Allocations should happen in the initialize() virtual, so move it there.
This commit is contained in:
Andreas Kling 2022-09-03 18:47:33 +02:00
parent ffad902c07
commit b30e95eb27
2 changed files with 10 additions and 3 deletions

View file

@ -45,7 +45,6 @@ namespace Web::DOM {
Element::Element(Document& document, DOM::QualifiedName qualified_name)
: ParentNode(document, NodeType::ELEMENT_NODE)
, m_qualified_name(move(qualified_name))
, m_attributes(NamedNodeMap::create(*this))
{
set_prototype(&window().cached_web_prototype("Element"));
make_html_uppercased_qualified_name();
@ -53,6 +52,12 @@ Element::Element(Document& document, DOM::QualifiedName qualified_name)
Element::~Element() = default;
void Element::initialize(JS::Realm& realm)
{
Base::initialize(realm);
m_attributes = NamedNodeMap::create(*this);
}
void Element::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);