mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:27:35 +00:00
LibWeb: Don't allocate DOMStringMap in HTMLElement constructor
Allocations go in initialize().
This commit is contained in:
parent
b30e95eb27
commit
05dcf3b2f8
2 changed files with 9 additions and 2 deletions
|
@ -30,13 +30,18 @@ namespace Web::HTML {
|
|||
|
||||
HTMLElement::HTMLElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: Element(document, move(qualified_name))
|
||||
, m_dataset(DOMStringMap::create(*this))
|
||||
{
|
||||
set_prototype(&window().cached_web_prototype("HTMLElement"));
|
||||
}
|
||||
|
||||
HTMLElement::~HTMLElement() = default;
|
||||
|
||||
void HTMLElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
m_dataset = DOMStringMap::create(*this);
|
||||
}
|
||||
|
||||
void HTMLElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
protected:
|
||||
HTMLElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
@ -69,7 +71,7 @@ private:
|
|||
};
|
||||
ContentEditableState content_editable_state() const;
|
||||
|
||||
JS::NonnullGCPtr<DOMStringMap> m_dataset;
|
||||
JS::GCPtr<DOMStringMap> m_dataset;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#locked-for-focus
|
||||
bool m_locked_for_focus { false };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue