gecko-dev/testing/web-platform/tests/css/css-syntax/cdc-vs-ident-tokens.html
Tab Atkins Jr 876a136a4c Bug 1529046 [wpt PR 15421] - CDC versus Ident Token, a=testonly
Automatic update from web-platform-tests
CDC versus Ident Token

Tests <https://github.com/w3c/csswg-drafts/issues/3623>.

If the CDC-vs-ident check is performed in the wrong order, you will attempt to parse the CDC as an ident instead, emitting a `--` ident token, and then a `>` delim token.

Thus, if this test is parsed incorrectly, it'll instead think the selector is `-- > --foo`, a valid selector with two tagname selectors separated by a child combinator.
--
lint: remove trailing whitespace
--
Merge pull request #15421 from web-platform-tests/tabatkins-patch-2

CDC versus Ident Token

--

wpt-commits: c79dbe6d777590620087aadbceb07668d3f2fd89, bf1be2ec37487a34adb4ac2ca75b7a061d27b8fe, 542f927a85e239ae514db33e73d4421f86b267ae
wpt-pr: 15421
2019-03-16 12:12:54 +00:00

28 lines
662 B
HTML

<!doctype html>
<title>CDC versus Ident Token</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
-->
--foo { color: blue; }
</style>
<meta name=author content="Tab Atkins-Bittner">
<link rel=help href="https://drafts.csswg.org/css-syntax/#consume-token">
<!--
The ordering of the checks in the HYPHEN-MINUS step is important;
if you get it wrong, ident-token can swallow cdc-token.
-->
<script>
test(()=>{
const rule = document.styleSheets[0].cssRules[0];
assert_equals(rule.selectorText, "--foo");
}, "CDC-token is properly emitted, and not parsed as an ident.");
</script>