LibWeb: Throw error on insertRule with disallowed @namespace rule

Resolves a FIXME in `CSSRuleList::insert_a_css_rule`. Gets us a bit
closer to passing https://wpt.live/css/cssom/at-namespace.html but that
requires more work around parsing of selectors with namespaces (namely
disallowing use of undeclared selectors), which I have added a FIXME
for.
This commit is contained in:
Callum Law 2025-06-09 22:33:36 +12:00 committed by Sam Atkins
parent 3421cd76fa
commit f53bec3a67
Notes: github-actions[bot] 2025-06-09 10:57:43 +00:00
4 changed files with 36 additions and 1 deletions

View file

@ -258,6 +258,9 @@ Optional<Selector::SimpleSelector::QualifiedName> Parser::parse_selector_qualifi
? Selector::SimpleSelector::QualifiedName::NamespaceType::Any
: Selector::SimpleSelector::QualifiedName::NamespaceType::Named;
// FIXME: https://www.w3.org/TR/selectors-4/#invalid
// - a simple selector containing an undeclared namespace prefix is invalid
transaction.commit();
return Selector::SimpleSelector::QualifiedName {
.namespace_type = namespace_type,