1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

LibWeb: Make :enabled and :disabled selector handling more idiomatic

This commit is contained in:
Andreas Kling 2022-07-27 17:18:32 +02:00
parent 2ad98fdf80
commit 031322fde3

View file

@ -211,15 +211,15 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
case CSS::Selector::SimpleSelector::PseudoClass::Type::Lang:
return matches_lang_pseudo_class(element, pseudo_class.languages);
case CSS::Selector::SimpleSelector::PseudoClass::Type::Disabled:
if (!element.tag_name().equals_ignoring_case(HTML::TagNames::input))
if (!is<HTML::HTMLInputElement>(element))
return false;
if (!element.has_attribute("disabled"))
if (!element.has_attribute(HTML::AttributeNames::disabled))
return false;
return true;
case CSS::Selector::SimpleSelector::PseudoClass::Type::Enabled:
if (!element.tag_name().equals_ignoring_case(HTML::TagNames::input))
if (!is<HTML::HTMLInputElement>(element))
return false;
if (element.has_attribute("disabled"))
if (element.has_attribute(HTML::AttributeNames::disabled))
return false;
return true;
case CSS::Selector::SimpleSelector::PseudoClass::Type::Checked: