mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Use Element::id() in SelectorEngine
This makes ID selector matching O(1) instead of O(n).
This commit is contained in:
parent
1c62ee9396
commit
83c3490bc4
Notes:
sideshowbarker
2024-07-17 00:37:23 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/83c3490bc4 Pull-request: https://github.com/SerenityOS/serenity/pull/21746 Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 1 additions and 1 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue