1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

LibWeb: Cache the "id" attribute value on DOM::Element as FlyString

This will allow us to do O(1) checks against the element ID when
matching selectors, etc.
This commit is contained in:
Andreas Kling 2023-11-02 14:56:48 +01:00
parent 6b580d68a3
commit 1c62ee9396
2 changed files with 10 additions and 1 deletions

View file

@ -375,6 +375,8 @@ public:
};
Directionality directionality() const;
Optional<FlyString> const& id() const { return m_id; }
protected:
Element(Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
@ -411,6 +413,8 @@ private:
Vector<FlyString> m_classes;
Optional<Dir> m_dir;
Optional<FlyString> m_id;
Array<JS::GCPtr<Layout::Node>, to_underlying(CSS::Selector::PseudoElement::PseudoElementCount)> m_pseudo_element_nodes;
// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-reaction-queue