2 <script src=
"../../../resources/js-test.js"></script>
4 input { background-color: transparent }
5 #inputOptional:optional,
6 #inputRequired:required {
7 background-color: green
14 <input id=
"inputOptional" required
></input>
19 <input id=
"inputRequired"></input>
25 description("Use descendant invalidation sets for :required and :optional pseudo classes.")
27 var transparent
= "rgba(0, 0, 0, 0)";
28 var green
= "rgb(0, 128, 0)";
30 shouldBe("getComputedStyle(inputOptional, '').backgroundColor", "transparent");
31 document
.body
.offsetTop
; // Force recalc.
32 inputOptional
.removeAttribute("required");
34 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
35 shouldBe("getComputedStyle(inputOptional, '').backgroundColor", "green");
37 shouldBe("getComputedStyle(inputRequired, '').backgroundColor", "transparent");
38 document
.body
.offsetTop
; // Force recalc.
39 inputRequired
.setAttribute("required", "");
41 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
42 shouldBe("getComputedStyle(inputRequired, '').backgroundColor", "green");