OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <style> | 4 <style> |
5 @-webkit-keyframes anim { | 5 @-webkit-keyframes anim { |
6 from { | 6 from { |
7 background-color: red; | 7 background-color: red; |
8 } | 8 } |
9 to { | 9 to { |
10 background-color: green; | 10 background-color: green; |
11 } | 11 } |
12 } | 12 } |
13 </style> | 13 </style> |
14 <script src="../../../resources/js-test.js"></script> | 14 <script src="../../../resources/js-test.js"></script> |
15 </head> | 15 </head> |
16 <body> | 16 <body> |
17 <div id="d1"></div> | 17 <div id="d1"></div> |
18 <div id="d2"></div> | 18 <div id="d2"></div> |
19 <div id="d3"></div> | |
20 <div id="result"></div> | 19 <div id="result"></div> |
21 <script> | 20 <script> |
22 if (window.testRunner) | 21 if (window.testRunner) |
23 testRunner.waitUntilDone(); | 22 testRunner.waitUntilDone(); |
24 | 23 |
25 function getBackgroundColor(element) { | 24 function getBackgroundColor(element) { |
26 return window.getComputedStyle(element).backgroundColor; | 25 return window.getComputedStyle(element).backgroundColor; |
27 } | 26 } |
28 | 27 |
29 var shadowRootWithKeyframe = document.getElementById("d1").createShadowRoot(); | 28 var shadowRootWithKeyframe = document.getElementById("d1").createShadowRoot(); |
30 shadowRootWithKeyframe.innerHTML = '<style>@-webkit-keyframes "anim" {' + | 29 shadowRootWithKeyframe.innerHTML = '<style>@-webkit-keyframes "anim" {' + |
31 'from { background-color:red; } to { background-color: blue; } }' + | 30 'from { background-color:red; } to { background-color: blue; } }' + |
32 '#box { height: 100px; width: 100px; background: red; ' + | 31 '#box { height: 100px; width: 100px; background: red; ' + |
33 '-webkit-animation: "anim" 0.5s both; }</style>' + | 32 '-webkit-animation: "anim" 0.5s both; }</style>' + |
34 '<div id="box"></div>'; | 33 '<div id="box"></div>'; |
35 | 34 |
36 var shadowRootWithoutKeyframe = document.getElementById("d2").createShadowRoot()
; | 35 var shadowRootWithoutKeyframe = document.getElementById("d2").createShadowRoot()
; |
37 shadowRootWithoutKeyframe.applyAuthorStyles = false; | |
38 shadowRootWithoutKeyframe.innerHTML = '<style>' + | 36 shadowRootWithoutKeyframe.innerHTML = '<style>' + |
39 '#box { height: 100px; width: 100px; background: red; ' + | 37 '#box { height: 100px; width: 100px; background: red; ' + |
40 '-webkit-animation: "anim" 0.5s both; }</style>' + | 38 '-webkit-animation: "anim" 0.5s both; }</style>' + |
41 '<div id="box"></div>'; | 39 '<div id="box"></div>'; |
42 | 40 |
43 var shadowRootWithApplyAuthorStyles = document.getElementById("d3").createShadow
Root(); | |
44 shadowRootWithApplyAuthorStyles.applyAuthorStyles = true; | |
45 shadowRootWithApplyAuthorStyles.innerHTML = '<style>' + | |
46 '#box { height: 100px; width: 100px; background: red; ' + | |
47 '-webkit-animation: "anim" 0.5s both; }</style>' + | |
48 '<div id="box"></div>'; | |
49 | |
50 window.setTimeout(function() { | 41 window.setTimeout(function() { |
51 shouldBe("getBackgroundColor(shadowRootWithKeyframe.getElementById('box'))",
'"rgb(0, 0, 255)"'); | 42 shouldBe("getBackgroundColor(shadowRootWithKeyframe.getElementById('box'))",
'"rgb(0, 0, 255)"'); |
52 shouldBe("getBackgroundColor(shadowRootWithoutKeyframe.getElementById('box')
)", '"rgb(255, 0, 0)"'); | 43 shouldBe("getBackgroundColor(shadowRootWithoutKeyframe.getElementById('box')
)", '"rgb(255, 0, 0)"'); |
53 shouldBe("getBackgroundColor(shadowRootWithApplyAuthorStyles.getElementById(
'box'))", '"rgb(0, 128, 0)"'); | |
54 if (window.testRunner) | 44 if (window.testRunner) |
55 testRunner.notifyDone(); | 45 testRunner.notifyDone(); |
56 }, 1000); | 46 }, 1000); |
57 </script> | 47 </script> |
58 </body> | 48 </body> |
59 </html> | 49 </html> |
OLD | NEW |