mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:07:36 +00:00
LibWeb: Hoist case sensitivity check out of loop in Element::has_class()
This commit is contained in:
parent
8deced39a8
commit
d9c64ee876
1 changed files with 9 additions and 5 deletions
|
@ -251,11 +251,15 @@ Vector<String> Element::get_attribute_names() const
|
||||||
|
|
||||||
bool Element::has_class(FlyString const& class_name, CaseSensitivity case_sensitivity) const
|
bool Element::has_class(FlyString const& class_name, CaseSensitivity case_sensitivity) const
|
||||||
{
|
{
|
||||||
|
if (case_sensitivity == CaseSensitivity::CaseSensitive) {
|
||||||
return any_of(m_classes, [&](auto& it) {
|
return any_of(m_classes, [&](auto& it) {
|
||||||
return case_sensitivity == CaseSensitivity::CaseSensitive
|
return it == class_name;
|
||||||
? it == class_name
|
|
||||||
: it.equals_ignoring_case(class_name);
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
return any_of(m_classes, [&](auto& it) {
|
||||||
|
return it.equals_ignoring_case(class_name);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<Layout::Node> Element::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
RefPtr<Layout::Node> Element::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue