Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement CSSOM CSSCounterStyleRule API name setter #27585

Merged
merged 1 commit into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 46 additions & 0 deletions css/css-counter-styles/cssom/cssom-name-setter-invalid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<title>CSSCounterStyleRule name setter with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-counter-styles-3/#the-csscounterstylerule-interface">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<link rel="match" href="cssom-name-setter-ref.html">
<style id="sheet">
@counter-style foo {
system: fixed;
symbols: A B C;
}

@counter-style bar {
system: fixed;
symbols: X Y Z;
}
</style>

<ol style="list-style-type: foo; list-style-position: inside">
<li></li>
<li></li>
<li></li>
</ol>

<ol style="list-style-type: bar; list-style-position: inside">
<li></li>
<li></li>
<li></li>
</ol>

<script>
// Force layout update before changing the rule
document.body.offsetWidth;

const sheet = document.getElementById('sheet');
const rule = sheet.sheet.rules[0];

// Invalid values should be ignored
rule.name = '';
rule.name = '123';
rule.name = 'initial';
rule.name = 'inherit';
rule.name = 'unset';
rule.name = 'none';
rule.name = 'disc';
rule.name = 'decimal';
</script>
14 changes: 14 additions & 0 deletions css/css-counter-styles/cssom/cssom-name-setter-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<title>CSSCounterStyleRule name setter</title>

<ol>
<div>A.</div>
<div>B.</div>
<div>C.</div>
</ol>

<ol>
<div>X.</div>
<div>Y.</div>
<div>Z.</div>
</ol>
43 changes: 43 additions & 0 deletions css/css-counter-styles/cssom/cssom-name-setter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<title>CSSCounterStyleRule name setter</title>
<link rel="help" href="https://www.w3.org/TR/css-counter-styles-3/#the-csscounterstylerule-interface">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<link rel="match" href="cssom-name-setter-ref.html">
<style id="sheet">
@counter-style foo {
system: fixed;
symbols: A B C;
}

@counter-style bar {
system: fixed;
symbols: '1' '2' '3';
}

@counter-style foo {
system: fixed;
symbols: X Y Z;
}
</style>

<ol style="list-style-type: foo; list-style-position: inside">
<li></li>
<li></li>
<li></li>
</ol>

<ol style="list-style-type: bar; list-style-position: inside">
<li></li>
<li></li>
<li></li>
</ol>

<script>
// Force layout update before changing the rule
document.body.offsetWidth;

// Change the last counter style name from 'foo' to 'bar'
const sheet = document.getElementById('sheet');
const rule = sheet.sheet.rules[2];
rule.name = 'bar';
</script>