LibWeb: Use Element::id() in SelectorEngine

This makes ID selector matching O(1) instead of O(n).
This commit is contained in:
Andreas Kling 2023-11-02 14:57:40 +01:00
parent 1c62ee9396
commit 83c3490bc4
Notes: sideshowbarker 2024-07-17 00:37:23 +09:00

View file

@ -583,7 +583,7 @@ static inline bool matches(CSS::Selector::SimpleSelector const& component, Optio
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
} }
case CSS::Selector::SimpleSelector::Type::Id: case CSS::Selector::SimpleSelector::Type::Id:
return component.name() == element.deprecated_attribute(HTML::AttributeNames::id).view(); return component.name() == element.id();
case CSS::Selector::SimpleSelector::Type::Class: case CSS::Selector::SimpleSelector::Type::Class:
return element.has_class(component.name()); return element.has_class(component.name());
case CSS::Selector::SimpleSelector::Type::Attribute: case CSS::Selector::SimpleSelector::Type::Attribute: