test_bug887741_at-rules_in_declaration_lists.html (2274B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=887741 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 887741: at-rules in declaration lists</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <style> 11 #foo { 12 color: red; 13 @invalid-rule { 14 ignored: ignored; 15 } 16 /* No semicolon */ 17 color: green; 18 } 19 @page { 20 margin-top: 0; 21 @bottom-center { 22 content: counter(page); 23 } 24 /* No semicolon */ 25 margin-top: 5cm; 26 } 27 @keyframes dummy-animation { 28 12% { 29 color: red; 30 @invalid-rule {} 31 /* No semicolon */ 32 color: green; 33 } 34 } 35 /* TODO: other at-rules that use declaration syntax? */ 36 </style> 37 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 38 </head> 39 <body> 40 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=887741">Mozilla Bug 887741</a> 41 <p id="display"></p> 42 <div id="content" style="display: none; color: red; 43 @invalid-rule{} /* No semicolon */ color: green;"> 44 45 </div> 46 <pre id="test"> 47 <script type="application/javascript"> 48 49 /** Test for Bug 887741 */ 50 51 var style = document.getElementById('content').style; 52 is(style.display, 'none', 'Sanity check: we have the right element'); 53 is(style.color, 'green', 'Support at-rules in style attributes'); 54 55 style.cssText = 'display: none; color: red; @invalid-rule{} /* No semicolon */ color: lime;'; 56 is(style.color, 'lime', 'Support at-rules in CSSStyleDeclaration.cssText'); 57 58 var rules = document.styleSheets[0].cssRules; 59 var style_rule = rules[0]; 60 is(style_rule.selectorText, '#foo', 'Sanity check: we have the right style rule'); 61 is(style_rule.style.color, 'green', 'Support at-rules in style rules'); 62 63 var page_rule = rules[1]; 64 is(page_rule.type, page_rule.PAGE_RULE, 'Sanity check: we have the right style rule'); 65 is(page_rule.style.marginTop, '5cm', 'Support at-rules in @page rules'); 66 67 var keyframe_rule = rules[2].cssRules[0]; 68 is(keyframe_rule.keyText, '12%', 'Sanity check: we have the right keyframe rule'); 69 is(keyframe_rule.style.color, 'green', 'Support at-rules in keyframe rules') 70 71 </script> 72 </pre> 73 </body> 74 </html>