test_bug716226.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=716226
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 716226</title>
  9. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  11. <style id="s">
  12. @keyframes foo { }
  13. </style>
  14. </head>
  15. <body>
  16. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=716226">Mozilla Bug 716226</a>
  17. <p id="display"></p>
  18. <div id="content" style="display: none">
  19. </div>
  20. <pre id="test">
  21. <script type="application/javascript">
  22. /** Test for Bug 716226 **/
  23. var sheet = $("s").sheet;
  24. var rules = sheet.cssRules;
  25. is(rules.length, 1, "Should have one keyframes rule");
  26. var keyframesRule = rules[0];
  27. var keyframeRules = keyframesRule.cssRules;
  28. is(keyframeRules.length, 0, "Should have no keyframe rules yet");
  29. keyframesRule.appendRule('0% { }');
  30. is(keyframeRules.length, 1, "Should have a keyframe rule now");
  31. var keyframeRule = keyframeRules[0];
  32. is(keyframeRule.parentRule, keyframesRule,
  33. "Parent of keyframe should be keyframes");
  34. is(keyframeRule.parentStyleSheet, sheet,
  35. "Parent stylesheet of keyframe should be our sheet");
  36. is(keyframeRule.style.cssText, "", "Should have no declarations yet");
  37. // Note: purposefully non-canonical cssText string so we can make sure we
  38. // really invoked the CSS parser and serializer.
  39. keyframeRule.style.cssText = "color:green";
  40. is(keyframeRule.style.cssText, "color: green;",
  41. "Should have the declarations we set now");
  42. </script>
  43. </pre>
  44. </body>
  45. </html>