From eec34ae0e94f02511b24c1e632eb03b36424881b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 15 Feb 2022 23:50:16 +0100 Subject: [PATCH] LibWeb: Make :checked selector actually look at checkedness It was incorrectly testing for presence of the "checked" attribute. --- Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp index d897578b08..cb13ee86ed 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace Web::SelectorEngine { @@ -105,9 +106,7 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla case CSS::Selector::SimpleSelector::PseudoClass::Type::Checked: if (!element.tag_name().equals_ignoring_case(HTML::TagNames::input)) return false; - if (!element.has_attribute("checked")) - return false; - return true; + return static_cast(element).checked(); case CSS::Selector::SimpleSelector::PseudoClass::Type::Not: for (auto& selector : pseudo_class.not_selector) { if (matches(selector, element))