LibWeb: Make sure we run selectors for mixed-case tag names

Before this change, we would never apply CSS rules where the selector
had a mixed-case tag name. This happened because our rule caches would
key them on the lowercased tag name, but we didn't lowercase the tag
name when fetching things from the cache.

This uncovered the fact that the SVG2 spec has a bunch of style applied
to non-rendered elements in a way that doesn't match other browsers.
Instead of blindly following the spec, we now match other browsers.
This commit is contained in:
Andreas Kling 2025-07-07 15:18:22 +02:00 committed by Andreas Kling
parent 61df035612
commit b3fd939628
Notes: github-actions[bot] 2025-07-09 12:37:53 +00:00
5 changed files with 11 additions and 10 deletions

View file

@ -3280,7 +3280,7 @@ void RuleCache::for_each_matching_rules(DOM::Element const& element, Optional<Ps
return;
}
}
if (auto it = rules_by_tag_name.find(element.local_name()); it != rules_by_tag_name.end()) {
if (auto it = rules_by_tag_name.find(element.lowercased_local_name()); it != rules_by_tag_name.end()) {
if (callback(it->value) == IterationDecision::Break)
return;
}