LibWeb: Allow whitespace in not after a boolean-expr-group

This commit is contained in:
Lorenz A 2025-10-28 18:17:33 +01:00 committed by Jelle Raaijmakers
parent 32cfb4e7d8
commit 14dba82202
3 changed files with 61 additions and 0 deletions

View File

@ -220,6 +220,7 @@ OwnPtr<BooleanExpression> Parser::parse_boolean_expression(TokenStream<Component
tokens.discard_whitespace();
if (auto child = parse_boolean_expression_group(tokens, result_for_general_enclosed, parse_test)) {
tokens.discard_whitespace();
transaction.commit();
return BooleanNotExpression::create(child.release_nonnull());
}

View File

@ -0,0 +1,21 @@
Harness status: OK
Found 16 tests
16 Pass
Pass @supports ((a)) {}
Pass @supports ((a) ) {}
Pass @supports ( (a)) {}
Pass @supports ( (a) ) {}
Pass @supports (not (a)) {}
Pass @supports (not (a) ) {}
Pass @supports ( not (a)) {}
Pass @supports ( not (a) ) {}
Pass @supports ((a) and (b)) {}
Pass @supports ((a) and (b) ) {}
Pass @supports ( (a) and (b)) {}
Pass @supports ( (a) and (b) ) {}
Pass @supports ((a) or (b)) {}
Pass @supports ((a) or (b) ) {}
Pass @supports ( (a) or (b)) {}
Pass @supports ( (a) or (b) ) {}

View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<title>Parsing of @supports with whitespace</title>
<link rel="help" href="https://drafts.csswg.org/css-conditional-3/#at-supports">
<script src=../../resources/testharness.js></script>
<script src=../../resources/testharnessreport.js></script>
<main id=main></main>
<script>
let examples = [
'@supports ((a)) {}',
'@supports ((a) ) {}',
'@supports ( (a)) {}',
'@supports ( (a) ) {}',
'@supports (not (a)) {}',
'@supports (not (a) ) {}',
'@supports ( not (a)) {}',
'@supports ( not (a) ) {}',
'@supports ((a) and (b)) {}',
'@supports ((a) and (b) ) {}',
'@supports ( (a) and (b)) {}',
'@supports ( (a) and (b) ) {}',
'@supports ((a) or (b)) {}',
'@supports ((a) or (b) ) {}',
'@supports ( (a) or (b)) {}',
'@supports ( (a) or (b) ) {}',
];
for (let example of examples) {
test((t) => {
let style = document.createElement('style');
t.add_cleanup(() => style.remove());
style.textContent = example;
main.append(style);
assert_equals(style.sheet.rules.length, 1);
}, example);
}
</script>