LibWeb: Create Element::attributes (NamedNodeMap) lazily

Many elements have zero attributes, and they don't need a NamedNodeMap
until someone asks for it.
This commit is contained in:
Andreas Kling 2025-04-20 15:08:08 +02:00 committed by Andreas Kling
commit 94cc4adefd
Notes: github-actions[bot] 2025-04-20 16:44:29 +00:00
3 changed files with 53 additions and 16 deletions

View file

@ -154,7 +154,10 @@ public:
WebIDL::ExceptionOr<bool> toggle_attribute(FlyString const& name, Optional<bool> force);
size_t attribute_list_size() const;
NamedNodeMap const* attributes() const { return m_attributes.ptr(); }
GC::Ptr<NamedNodeMap const> attributes() const;
GC::Ptr<NamedNodeMap> attributes();
Vector<String> get_attribute_names() const;
GC::Ptr<Attr> get_attribute_node(FlyString const& name) const;