2 <script src=
"../../../resources/js-test.js"></script>
4 input { background-color: transparent }
9 background-color: green
17 <input id=
"inputValid" required
></input>
22 <input id=
"inputInvalid"></input>
28 <input id=
"inputInFormValid" type=
"text" required
></input>
29 <input type=
"text"></input>
30 <input type=
"text"></input>
36 <form id=
"formInvalid">
37 <input id=
"inputInFormInvalid" type=
"text"></input>
38 <input type=
"text"></input>
39 <input type=
"text"></input>
47 description("Use descendant invalidation sets for :valid and :invalid pseudo classes.")
49 var transparent
= "rgba(0, 0, 0, 0)";
50 var green
= "rgb(0, 128, 0)";
52 shouldBe("getComputedStyle(inputValid, '').backgroundColor", "transparent");
53 document
.body
.offsetTop
; // Force recalc.
54 inputValid
.removeAttribute("required");
56 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
57 shouldBe("getComputedStyle(inputValid, '').backgroundColor", "green");
59 shouldBe("getComputedStyle(inputInvalid, '').backgroundColor", "transparent");
60 document
.body
.offsetTop
; // Force recalc.
61 inputInvalid
.setAttribute("required", "");
63 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
64 shouldBe("getComputedStyle(inputInvalid, '').backgroundColor", "green");
66 shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "transparent");
67 document
.body
.offsetTop
; // Force recalc.
68 inputInFormValid
.removeAttribute("required");
70 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
71 shouldBe("getComputedStyle(formValid, '').backgroundColor", "green");
73 shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "transparent");
74 document
.body
.offsetTop
; // Force recalc.
75 inputInFormInvalid
.setAttribute("required", "");
77 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
78 shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "green");