Skip to content

Commit

Permalink
Consume whitespace after 'not <supports-in-parens>'
Browse files Browse the repository at this point in the history
Fixes a bug where e.g. '@supports (not (a) )' would fail to parse.

Fixed: 1330233
Change-Id: Ic9a2f58283e8e45859c75153309db12668f65af5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3688074
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Kevin Babbitt <kbabbitt@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1013641}
  • Loading branch information
andruud authored and chromium-wpt-export-bot committed Jun 13, 2022
1 parent 29a7d56 commit 1a70cf7
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions css/css-conditional/at-supports-whitespace.html
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 1a70cf7

Please sign in to comment.