OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
3 | 3 |
4 <style> | 4 <style> |
5 .outer .inner {} | 5 div { width: 100px } |
6 .outer .inner { width: 200px } | |
6 </style> | 7 </style> |
7 | 8 |
8 <div id="outer"> | 9 <div id="outer"> |
9 <div id="inner" class="inner"> | 10 <div id="inner" class="inner"> |
11 <div id="innerChild"> | |
rune
2014/02/18 22:13:24
Nit: "innerChild" id unused. Would make sense to h
chrishtr
2014/02/18 22:33:16
Done.
| |
12 </div> | |
10 </div> | 13 </div> |
11 <div id="inner2"> | 14 <div id="inner2"> |
12 </div> | 15 </div> |
13 </div> | 16 </div> |
14 | 17 |
15 <script> | 18 <script> |
16 description("Test that adding and removing class names only updates the elements that are affected."); | 19 description("Test that adding and removing class names only updates the elements that are affected."); |
17 | 20 |
18 function insertStyleSheet(css) | 21 function insertStyleSheet(css) |
19 { | 22 { |
20 var styleElement = document.createElement("style"); | 23 var styleElement = document.createElement("style"); |
21 styleElement.textContent = css; | 24 styleElement.textContent = css; |
22 (document.head || document.documentElement).appendChild(styleElement); | 25 (document.head || document.documentElement).appendChild(styleElement); |
23 } | 26 } |
24 | 27 |
25 var outer = document.getElementById('outer'); | 28 var outer = document.getElementById('outer'); |
26 | 29 var inner = document.getElementById('inner'); |
27 outer.offsetTop; | |
28 outer.className = 'outer'; | |
29 | 30 |
30 // Style recalc should happen on "inner" and "outer", but not "inner2". | 31 // Style recalc should happen on "inner" and "outer", but not "inner2". |
31 | 32 |
32 var count; | 33 var count; |
33 if (internals.runtimeFlags.targetedStyleRecalcEnabled) | 34 if (internals.runtimeFlags.targetedStyleRecalcEnabled) |
34 count = 2; | 35 count = 2; |
35 else | 36 else |
36 count = 3; | 37 count = 4; |
37 | 38 |
39 outer.offsetTop; | |
40 outer.className = 'outer'; | |
38 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", '' + count); | 41 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", '' + count); |
42 shouldBe("getComputedStyle(inner).width", '"200px"'); | |
43 | |
44 if (internals.runtimeFlags.targetedStyleRecalcEnabled) | |
45 count = 1; | |
46 else | |
47 count = 2; | |
48 | |
49 inner.offsetTop; | |
50 inner.className = ''; | |
51 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", '' + count); | |
52 shouldBe("getComputedStyle(inner).width", '"100px"'); | |
39 | 53 |
40 </script> | 54 </script> |
OLD | NEW |