Index: LayoutTests/fast/css/invalidation/targeted-class-id.html |
diff --git a/LayoutTests/fast/css/invalidation/targeted-class-id.html b/LayoutTests/fast/css/invalidation/targeted-class-id.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0284da8fc5c9733354709ab50a1daca651bb180d |
--- /dev/null |
+++ b/LayoutTests/fast/css/invalidation/targeted-class-id.html |
@@ -0,0 +1,41 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/js-test.js"></script> |
+<style> |
+.a1 #b1 { background-color: green } |
+.a2 div + #b2 { background-color: green } |
+</style> |
+<div id="t1"> |
+ <div></div> |
+ <div id="b1"></div> |
+</div> |
+<div id="t2"> |
+ <div></div> |
+ <div id="b2"></div> |
+</div> |
+<script> |
+description("Check that targeted class invalidation works for id selectors."); |
+ |
+var transparent = "rgba(0, 0, 0, 0)"; |
+var green = "rgb(0, 128, 0)"; |
+ |
+var b1 = document.getElementById("b1"); |
+var b2 = document.getElementById("b2"); |
+ |
+shouldBe("getComputedStyle(b1, null).backgroundColor", "transparent"); |
+shouldBe("getComputedStyle(b2, null).backgroundColor", "transparent"); |
+ |
+document.body.offsetTop; // Force style recalc. |
+ |
+document.getElementById("t1").className = "a1"; |
+if (window.internals) |
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2"); |
+shouldBe("getComputedStyle(b1, null).backgroundColor", "green"); |
+ |
+document.body.offsetLeft; // force style recalc. |
+ |
+document.getElementById("t2").className = "a2"; |
+if (window.internals) |
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "3"); |
+shouldBe("getComputedStyle(b2, null).backgroundColor", "green"); |
+ |
+</script> |