Index: LayoutTests/fast/css/invalidation/required-optional-pseudo.html |
diff --git a/LayoutTests/fast/css/invalidation/required-optional-pseudo.html b/LayoutTests/fast/css/invalidation/required-optional-pseudo.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..67f056d0cdfdb05105aac431519e00a6fae4a891 |
--- /dev/null |
+++ b/LayoutTests/fast/css/invalidation/required-optional-pseudo.html |
@@ -0,0 +1,44 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/js-test.js"></script> |
+<style> |
+input { background-color: transparent } |
+#inputOptional:optional, |
+#inputRequired:required { |
+ background-color: green |
+} |
+ |
+input + div { |
+ color: pink |
+} |
+</style> |
+<input id="inputOptional" required></input> |
+<div> |
+ <div></div> |
+ <div></div> |
+</div> |
+<input id="inputRequired"></input> |
+<div> |
+ <div></div> |
+ <div></div> |
+</div> |
+<script> |
+description("Use descendant invalidation sets for :required and :optional pseudo classes.") |
+ |
+var transparent = "rgba(0, 0, 0, 0)"; |
+var green = "rgb(0, 128, 0)"; |
+ |
+shouldBe("getComputedStyle(inputOptional, '').backgroundColor", "transparent"); |
+document.body.offsetTop; // Force recalc. |
+inputOptional.removeAttribute("required"); |
+if (window.internals) |
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); |
+shouldBe("getComputedStyle(inputOptional, '').backgroundColor", "green"); |
+ |
+shouldBe("getComputedStyle(inputRequired, '').backgroundColor", "transparent"); |
+document.body.offsetTop; // Force recalc. |
+inputRequired.setAttribute("required", ""); |
+if (window.internals) |
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); |
+shouldBe("getComputedStyle(inputRequired, '').backgroundColor", "green"); |
+ |
+</script> |