-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement at-rule for use with @supports.
It's behind a flag for now. Note that there is a CSSWG resolution (w3c/csswg-drafts#2463 (comment)) but no spec. We don't support the proposed but not yet ratified extension of having a full block (w3c/csswg-drafts#6966) Bug: 40211832 Change-Id: Ic80e28abe9e9fce6d44b1a52311aba7b60a8caa2
- Loading branch information
1 parent
a2112d6
commit 38c89cf
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!doctype html> | ||
<title>@supports at-rule</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-conditional-4/#the-css-namespace"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
function test_supports(rule, expected, desc) { | ||
test(() => { | ||
assert_equals(CSS.supports(rule), expected, 'CSS.supports(' + rule + ')'); | ||
}, desc); | ||
} | ||
|
||
// Basic at-rule support. | ||
test_supports("at-rule(@supports)", true); | ||
test_supports("at-rule( @supports)", true); | ||
test_supports("at-rule(@supports )", true); | ||
test_supports("at-rule(@media)", true); | ||
test_supports("at-rule(@counter-style)", true); | ||
test_supports("at-rule(@doesnotexist)", false); | ||
|
||
// With descriptors. | ||
test_supports("at-rule(@counter-style; system: fixed)", true); | ||
test_supports("at-rule(@counter-style;system: fixed )", true); | ||
test_supports("at-rule(@counter-style;system: fixed )", true); | ||
test_supports("at-rule(@counter-style; system:)", false, "missing value 1"); | ||
test_supports("at-rule(@counter-style; system: )", false, "missing value 2"); | ||
test_supports("at-rule(@counter-style; system: doesnotexist)", false, "invalid value"); | ||
test_supports("at-rule(@counter-style; system: fixed junk)", false, "junk after value"); | ||
test_supports("at-rule(@counter-style; system)", false, "missing value 3"); | ||
test_supports("at-rule(@counter-style! system: fixed)", false, "invalid separator"); | ||
test_supports("at-rule(@counter-style; suffix: \"abc\")", true, "quoted value is OK"); | ||
test_supports("at-rule(@counter-style; suffix: \"abc\";)", false, "semicolon after value"); | ||
test_supports("at-rule(@counter-style; suffix: \"abc\"", true, "implicit end parenthesis"); | ||
test_supports("at-rule(@counter-style; system: fixed; system: fixed)", false, "multiple descriptors"); | ||
test_supports("at-rule(@supports; system: fixed)", false, "descriptor invalid in context"); | ||
test_supports("at-rule(@media; color: red)", false, "properties are not descriptors"); | ||
</script> |