test_bug716226.html (1554B)
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 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 20 </div> 21 <pre id="test"> 22 <script type="application/javascript"> 23 24 /** Test for Bug 716226 */ 25 var sheet = $("s").sheet; 26 var rules = sheet.cssRules; 27 is(rules.length, 1, "Should have one keyframes rule"); 28 var keyframesRule = rules[0]; 29 var keyframeRules = keyframesRule.cssRules; 30 is(keyframeRules.length, 0, "Should have no keyframe rules yet"); 31 32 keyframesRule.appendRule('0% { }'); 33 is(keyframeRules.length, 1, "Should have a keyframe rule now"); 34 var keyframeRule = keyframeRules[0]; 35 is(keyframeRule.parentRule, keyframesRule, 36 "Parent of keyframe should be keyframes"); 37 is(keyframeRule.parentStyleSheet, sheet, 38 "Parent stylesheet of keyframe should be our sheet"); 39 40 is(keyframeRule.style.cssText, "", "Should have no declarations yet"); 41 // Note: purposefully non-canonical cssText string so we can make sure we 42 // really invoked the CSS parser and serializer. 43 keyframeRule.style.cssText = "color:green"; 44 is(keyframeRule.style.cssText, "color: green;", 45 "Should have the declarations we set now"); 46 47 48 49 </script> 50 </pre> 51 </body> 52 </html>