Skip to content

Commit 14dba82

Browse files
lpasgmta
authored andcommitted
LibWeb: Allow whitespace in not after a boolean-expr-group
1 parent 32cfb4e commit 14dba82

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

Libraries/LibWeb/CSS/Parser/Parser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ OwnPtr<BooleanExpression> Parser::parse_boolean_expression(TokenStream<Component
220220
tokens.discard_whitespace();
221221

222222
if (auto child = parse_boolean_expression_group(tokens, result_for_general_enclosed, parse_test)) {
223+
tokens.discard_whitespace();
223224
transaction.commit();
224225
return BooleanNotExpression::create(child.release_nonnull());
225226
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Harness status: OK
2+
3+
Found 16 tests
4+
5+
16 Pass
6+
Pass @supports ((a)) {}
7+
Pass @supports ((a) ) {}
8+
Pass @supports ( (a)) {}
9+
Pass @supports ( (a) ) {}
10+
Pass @supports (not (a)) {}
11+
Pass @supports (not (a) ) {}
12+
Pass @supports ( not (a)) {}
13+
Pass @supports ( not (a) ) {}
14+
Pass @supports ((a) and (b)) {}
15+
Pass @supports ((a) and (b) ) {}
16+
Pass @supports ( (a) and (b)) {}
17+
Pass @supports ( (a) and (b) ) {}
18+
Pass @supports ((a) or (b)) {}
19+
Pass @supports ((a) or (b) ) {}
20+
Pass @supports ( (a) or (b)) {}
21+
Pass @supports ( (a) or (b) ) {}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE html>
2+
<title>Parsing of @supports with whitespace</title>
3+
<link rel="help" href="https://drafts.csswg.org/css-conditional-3/#at-supports">
4+
<script src=../../resources/testharness.js></script>
5+
<script src=../../resources/testharnessreport.js></script>
6+
<main id=main></main>
7+
<script>
8+
let examples = [
9+
'@supports ((a)) {}',
10+
'@supports ((a) ) {}',
11+
'@supports ( (a)) {}',
12+
'@supports ( (a) ) {}',
13+
14+
'@supports (not (a)) {}',
15+
'@supports (not (a) ) {}',
16+
'@supports ( not (a)) {}',
17+
'@supports ( not (a) ) {}',
18+
19+
'@supports ((a) and (b)) {}',
20+
'@supports ((a) and (b) ) {}',
21+
'@supports ( (a) and (b)) {}',
22+
'@supports ( (a) and (b) ) {}',
23+
24+
'@supports ((a) or (b)) {}',
25+
'@supports ((a) or (b) ) {}',
26+
'@supports ( (a) or (b)) {}',
27+
'@supports ( (a) or (b) ) {}',
28+
];
29+
30+
for (let example of examples) {
31+
test((t) => {
32+
let style = document.createElement('style');
33+
t.add_cleanup(() => style.remove());
34+
style.textContent = example;
35+
main.append(style);
36+
assert_equals(style.sheet.rules.length, 1);
37+
}, example);
38+
}
39+
</script>

0 commit comments

Comments
 (0)