LibWeb/CSS: Limit case-insensitive default comparison to HTML attributes

The HTML spec gives us a list of HTML attributes that must have their
values compared case-insensitively by default (when the attribute
selector does not specify a case-sensitiveness). However, ifwe have a
namespace, then we are not looking for an HTML attribute, so this
should not apply.

Gets us 8 more WPT subtest passes.
This commit is contained in:
Sam Atkins 2025-05-15 19:36:02 +01:00
parent d9113e45f0
commit ecdfb96a0a
Notes: github-actions[bot] 2025-05-16 15:43:04 +00:00
2 changed files with 11 additions and 10 deletions

View file

@ -303,6 +303,7 @@ static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute co
// See: https://html.spec.whatwg.org/multipage/semantics-other.html#case-sensitivity-of-selectors
if (element.document().is_html_document()
&& element.namespace_uri() == Namespace::HTML
&& attribute.qualified_name.namespace_type == CSS::Selector::SimpleSelector::QualifiedName::NamespaceType::Default
&& attribute_name.is_one_of(
HTML::AttributeNames::accept, HTML::AttributeNames::accept_charset, HTML::AttributeNames::align,
HTML::AttributeNames::alink, HTML::AttributeNames::axis, HTML::AttributeNames::bgcolor, HTML::AttributeNames::charset,