Skip to content

Commit

Permalink
Let css keyframes name accept string
Browse files Browse the repository at this point in the history
A @Keyframes block has a name given by the <custom-ident> or <string>
in its prelude. The two syntaxes are equivalent in functionality;
the name is the value of the ident or string[1].
[1]: https://drafts.csswg.org/css-animations/#typedef-keyframes-name

Bug: 882286
Change-Id: I2e9531beb17e38699dd0c535ae03f0bb16638227
  • Loading branch information
amoseui authored and chromium-wpt-export-bot committed Nov 7, 2018
1 parent f30b2e0 commit 3505503
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions css/cssom/CSSKeyframesRule.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@keyframes "string" {
0% { top: 0px; }
30% { top: 300px; }
}
@keyframes foo {
0% { top: 0px; }
100% { top: 200px; }
Expand All @@ -16,7 +20,13 @@

<script>
test(function () {
var keyframe = document.styleSheets[0].cssRules[0];
var stringKeyframe= document.styleSheets[0].cssRules[0];
assert_equals(stringKeyframe.name, "string", "CSSKeyframesRule name attribute");
assert_equals(stringKeyframe.cssRules.length, 2, "CSSKeyframesRule cssRule length attribute");
assert_equals(stringKeyframe.cssRules[0].cssText, "0% { top: 0px; }", "CSSKeyframesRule cssRule cssText attribute");
assert_equals(stringKeyframe.cssRules[1].cssText, "30% { top: 300px; }", "CSSKeyframesRule cssRule cssText attribute");

var keyframe = document.styleSheets[0].cssRules[1];
assert_equals(keyframe.name, "foo", "CSSKeyframesRule name attribute");
assert_equals(keyframe.cssRules.length, 2, "CSSKeyframesRule cssRule length attribute");
assert_equals(keyframe.cssRules[0].cssText, "0% { top: 0px; }", "CSSKeyframesRule cssRule cssText attribute");
Expand Down Expand Up @@ -56,7 +66,7 @@
assert_equals(keyframe.cssRules[2].cssText, "0% { top: 50px; }", "CSSKeyframesRule cssRule cssText attribute after deleteRule function");
assert_equals(keyframe.cssRules[3], undefined, "CSSKeyframesRule cssRule cssText attribute after deleteRule function");

var empty = document.styleSheets[0].cssRules[1];
var empty = document.styleSheets[0].cssRules[2];
empty.name = "bar";
assert_equals(empty.name, "bar", "CSSKeyframesRule name setter");
assert_equals(empty.cssText.replace(/\s/g, ""), "@keyframesbar{}", "CSSKeyframesRule cssText attribute");
Expand Down

0 comments on commit 3505503

Please sign in to comment.