diff --git a/Libraries/LibWeb/CSS/Selector.cpp b/Libraries/LibWeb/CSS/Selector.cpp index 3934418e38b..fa21ea031d5 100644 --- a/Libraries/LibWeb/CSS/Selector.cpp +++ b/Libraries/LibWeb/CSS/Selector.cpp @@ -159,11 +159,11 @@ void Selector::collect_ancestor_hashes() return; break; case SimpleSelector::Type::TagName: - if (append_unique_hash(simple_selector.qualified_name().name.name.hash())) + if (append_unique_hash(simple_selector.qualified_name().name.lowercase_name.hash())) return; break; case SimpleSelector::Type::Attribute: - if (append_unique_hash(simple_selector.attribute().qualified_name.name.name.hash())) + if (append_unique_hash(simple_selector.attribute().qualified_name.name.lowercase_name.hash())) return; break; default: diff --git a/Libraries/LibWeb/CSS/StyleComputer.cpp b/Libraries/LibWeb/CSS/StyleComputer.cpp index b3e8ad1c248..ce172438695 100644 --- a/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -3212,13 +3212,13 @@ void StyleComputer::compute_math_depth(ComputedProperties& style, DOM::Element c static void for_each_element_hash(DOM::Element const& element, auto callback) { - callback(element.local_name().hash()); + callback(element.local_name().ascii_case_insensitive_hash()); if (element.id().has_value()) callback(element.id().value().hash()); for (auto const& class_ : element.class_names()) callback(class_.hash()); element.for_each_attribute([&](auto& attribute) { - callback(attribute.local_name().hash()); + callback(attribute.lowercase_name().hash()); }); } diff --git a/Tests/LibWeb/Ref/expected/css-case-insensitive-html-attributes-selector-ref.html b/Tests/LibWeb/Ref/expected/css-case-insensitive-html-attributes-selector-ref.html index 1729f2bb21e..1fa027f52be 100644 --- a/Tests/LibWeb/Ref/expected/css-case-insensitive-html-attributes-selector-ref.html +++ b/Tests/LibWeb/Ref/expected/css-case-insensitive-html-attributes-selector-ref.html @@ -3,6 +3,10 @@ div[type=one] { background: red; } + div[type=three] { + background: blue; + }
I have a red background
I don't have a green background
+
I have a blue background
diff --git a/Tests/LibWeb/Ref/expected/css-tag-selector-case-sensitivity-html.html b/Tests/LibWeb/Ref/expected/css-tag-selector-case-sensitivity-html.html index 374fe31c8d2..e711df7b878 100644 --- a/Tests/LibWeb/Ref/expected/css-tag-selector-case-sensitivity-html.html +++ b/Tests/LibWeb/Ref/expected/css-tag-selector-case-sensitivity-html.html @@ -1,4 +1,5 @@
This should be green. + This should be red.
diff --git a/Tests/LibWeb/Ref/input/css-case-insensitive-html-attributes-selector.html b/Tests/LibWeb/Ref/input/css-case-insensitive-html-attributes-selector.html index 43885865101..96d58522bc4 100644 --- a/Tests/LibWeb/Ref/input/css-case-insensitive-html-attributes-selector.html +++ b/Tests/LibWeb/Ref/input/css-case-insensitive-html-attributes-selector.html @@ -7,6 +7,10 @@ div[test=two] { /* 'test' is NOT a case-insensitive html attribute */ background: green; } + [aB] div { + background: blue; + }
I have a red background
-
I don't have a green background
+
I don't have a green background
+
I have a blue background
diff --git a/Tests/LibWeb/Ref/input/css-tag-selector-case-sensitivity-html.html b/Tests/LibWeb/Ref/input/css-tag-selector-case-sensitivity-html.html index 1be47b28ad3..b7fda657ee3 100644 --- a/Tests/LibWeb/Ref/input/css-tag-selector-case-sensitivity-html.html +++ b/Tests/LibWeb/Ref/input/css-tag-selector-case-sensitivity-html.html @@ -4,8 +4,12 @@ DIV { color: green; } + DiV sPaN { + color: red; + }
This should be green. + This should be red.