LibWeb/CSS: Match *-namespace selectors against all attributes

Previously we only matched against the first attribute with a given
local name. What we actually want to do is look at each attribute with
that local name in turn and only return false if none of them match.

Also remove a hack for HTML elements in HTML documents, where we would
refuse to match any namespaced attributes. This doesn't seem to be
based on the spec, but we had regressions without it, until now. :^)

Gets us 21 more WPT subtest passes.
This commit is contained in:
Sam Atkins 2025-05-15 19:18:04 +01:00
commit 869abe0b21
Notes: github-actions[bot] 2025-05-16 15:42:59 +00:00
4 changed files with 132 additions and 126 deletions

View file

@ -194,16 +194,6 @@ Attr const* NamedNodeMap::get_attribute_ns(Optional<FlyString> const& namespace_
return nullptr;
}
Attr const* NamedNodeMap::get_attribute_namespace_agnostic(FlyString const& local_name) const
{
for (auto const& attribute : m_attributes) {
if (attribute->local_name() == local_name)
return attribute.ptr();
}
return nullptr;
}
// https://dom.spec.whatwg.org/#concept-element-attributes-set
WebIDL::ExceptionOr<GC::Ptr<Attr>> NamedNodeMap::set_attribute(Attr& attribute)
{