diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp index 43794e2f6b..d31b7ad564 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -341,6 +341,9 @@ static inline bool matches(CSS::Selector::SimpleSelector const& component, DOM:: case CSS::Selector::SimpleSelector::Type::Class: return element.has_class(component.name()); case CSS::Selector::SimpleSelector::Type::TagName: + // See https://html.spec.whatwg.org/multipage/semantics-other.html#case-sensitivity-of-selectors + if (is(element) && element.document().document_type() != DOM::Document::Type::XML) + return component.name().equals_ignoring_case(element.local_name()); return component.name() == element.local_name(); case CSS::Selector::SimpleSelector::Type::Attribute: return matches_attribute(component.attribute(), element);