Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-counter-styles/counter-style-at-rule/symbols-function-dynamic.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="UTF-8">
<title>CSS Test: symbols() marker updates after a script style change</title>
<link rel="author" title="Ananya Anand" href="mailto:t-anaanand@microsoft.com">
<link rel="match" href="symbols-function-dynamic-ref.html">
<link rel="stylesheet" href="support/test-common.css">
<style id="test-style" type="text/css">
#list {
list-style-type: symbols('*');
}
#counter {
list-style-type: none;
counter-reset: a;
}
#counter li {
counter-increment: a;
}
#counter li::after {
content: counter(a, symbols('*'));
}
</style>
<ol id="list">
<li><li><li>
</ol>
<ol id="counter">
<li><li><li>
</ol>
<script>
const sheet = document.getElementById('test-style').sheet;
const listRule =
[...sheet.cssRules].find(r => r.selectorText === '#list');
const counterRule =
[...sheet.cssRules].find(r => r.selectorText === '#counter li::after');
onload = () => {
// Force a layout so the initial symbols('*') counter styles are built and
// cached before the change.
document.body.getBoundingClientRect();
requestAnimationFrame(() => {
// Rewrite both symbols() values from script. The markers must update
// from '*' to '\\A7', proving the cached counter style is reset.
listRule.style.listStyleType = "symbols('\\A7')";
counterRule.style.content = "counter(a, symbols('\\A7'))";
requestAnimationFrame(() => {
document.documentElement.classList.remove('reftest-wait');
});
});
};
</script>
</html>