| 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 <style> | 3 <style> |
| 4 input { background-color: transparent } | 4 input { background-color: transparent } |
| 5 #inputValid:valid, | 5 #inputValid:valid, |
| 6 #inputInvalid:invalid, | 6 #inputInvalid:invalid, |
| 7 #formValid:valid, | 7 #formValid:valid, |
| 8 #formInvalid:invalid, | 8 #formInvalid:invalid, |
| 9 #maxlengthInvalid:invalid, | 9 #maxlengthInvalid:invalid, |
| 10 #minlengthInvalid:invalid { | 10 #minlengthInvalid:invalid { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 <script> | 58 <script> |
| 59 description("Use descendant invalidation sets for :valid and :invalid pseudo cla
sses.") | 59 description("Use descendant invalidation sets for :valid and :invalid pseudo cla
sses.") |
| 60 | 60 |
| 61 var transparent = "rgba(0, 0, 0, 0)"; | 61 var transparent = "rgba(0, 0, 0, 0)"; |
| 62 var green = "rgb(0, 128, 0)"; | 62 var green = "rgb(0, 128, 0)"; |
| 63 | 63 |
| 64 shouldBe("getComputedStyle(inputValid, '').backgroundColor", "transparent"); | 64 shouldBe("getComputedStyle(inputValid, '').backgroundColor", "transparent"); |
| 65 document.body.offsetTop; // Force recalc. | 65 document.body.offsetTop; // Force recalc. |
| 66 inputValid.removeAttribute("required"); | 66 inputValid.removeAttribute("required"); |
| 67 if (window.internals) | 67 if (window.internals) |
| 68 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); | 68 shouldBe("internals.updateStyleAndLayoutAndReturnAffectedElementCount()", "1
"); |
| 69 shouldBe("getComputedStyle(inputValid, '').backgroundColor", "green"); | 69 shouldBe("getComputedStyle(inputValid, '').backgroundColor", "green"); |
| 70 | 70 |
| 71 shouldBe("getComputedStyle(inputInvalid, '').backgroundColor", "transparent"); | 71 shouldBe("getComputedStyle(inputInvalid, '').backgroundColor", "transparent"); |
| 72 document.body.offsetTop; // Force recalc. | 72 document.body.offsetTop; // Force recalc. |
| 73 inputInvalid.setAttribute("required", ""); | 73 inputInvalid.setAttribute("required", ""); |
| 74 if (window.internals) | 74 if (window.internals) |
| 75 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); | 75 shouldBe("internals.updateStyleAndLayoutAndReturnAffectedElementCount()", "1
"); |
| 76 shouldBe("getComputedStyle(inputInvalid, '').backgroundColor", "green"); | 76 shouldBe("getComputedStyle(inputInvalid, '').backgroundColor", "green"); |
| 77 | 77 |
| 78 shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "transparent"); | 78 shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "transparent"); |
| 79 document.body.offsetTop; // Force recalc. | 79 document.body.offsetTop; // Force recalc. |
| 80 inputInFormValid.removeAttribute("required"); | 80 inputInFormValid.removeAttribute("required"); |
| 81 if (window.internals) | 81 if (window.internals) |
| 82 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2"); | 82 shouldBe("internals.updateStyleAndLayoutAndReturnAffectedElementCount()", "2
"); |
| 83 shouldBe("getComputedStyle(formValid, '').backgroundColor", "green"); | 83 shouldBe("getComputedStyle(formValid, '').backgroundColor", "green"); |
| 84 | 84 |
| 85 shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "transparent"); | 85 shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "transparent"); |
| 86 document.body.offsetTop; // Force recalc. | 86 document.body.offsetTop; // Force recalc. |
| 87 inputInFormInvalid.setAttribute("required", ""); | 87 inputInFormInvalid.setAttribute("required", ""); |
| 88 if (window.internals) | 88 if (window.internals) |
| 89 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2"); | 89 shouldBe("internals.updateStyleAndLayoutAndReturnAffectedElementCount()", "2
"); |
| 90 shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "green"); | 90 shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "green"); |
| 91 | 91 |
| 92 // Make sure the value is user input, otherwise setting maxlength/minlength | 92 // Make sure the value is user input, otherwise setting maxlength/minlength |
| 93 // won't cause a validation. | 93 // won't cause a validation. |
| 94 if (window.eventSender) { | 94 if (window.eventSender) { |
| 95 maxlengthInvalid.focus(); | 95 maxlengthInvalid.focus(); |
| 96 eventSender.keyDown("x"); | 96 eventSender.keyDown("x"); |
| 97 eventSender.keyDown("x"); | 97 eventSender.keyDown("x"); |
| 98 minlengthInvalid.focus(); | 98 minlengthInvalid.focus(); |
| 99 eventSender.keyDown("x"); | 99 eventSender.keyDown("x"); |
| 100 } | 100 } |
| 101 | 101 |
| 102 shouldBe("getComputedStyle(maxlengthInvalid, '').backgroundColor", "transparent"
); | 102 shouldBe("getComputedStyle(maxlengthInvalid, '').backgroundColor", "transparent"
); |
| 103 document.body.offsetTop; // Force recalc. | 103 document.body.offsetTop; // Force recalc. |
| 104 maxlengthInvalid.setAttribute("maxlength", "1"); | 104 maxlengthInvalid.setAttribute("maxlength", "1"); |
| 105 if (window.internals) | 105 if (window.internals) |
| 106 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); | 106 shouldBe("internals.updateStyleAndLayoutAndReturnAffectedElementCount()", "1
"); |
| 107 shouldBe("getComputedStyle(maxlengthInvalid, '').backgroundColor", "green"); | 107 shouldBe("getComputedStyle(maxlengthInvalid, '').backgroundColor", "green"); |
| 108 | 108 |
| 109 shouldBe("getComputedStyle(minlengthInvalid, '').backgroundColor", "transparent"
); | 109 shouldBe("getComputedStyle(minlengthInvalid, '').backgroundColor", "transparent"
); |
| 110 document.body.offsetTop; // Force recalc. | 110 document.body.offsetTop; // Force recalc. |
| 111 minlengthInvalid.setAttribute("minlength", "2"); | 111 minlengthInvalid.setAttribute("minlength", "2"); |
| 112 if (window.internals) | 112 if (window.internals) |
| 113 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); | 113 shouldBe("internals.updateStyleAndLayoutAndReturnAffectedElementCount()", "1
"); |
| 114 shouldBe("getComputedStyle(minlengthInvalid, '').backgroundColor", "green"); | 114 shouldBe("getComputedStyle(minlengthInvalid, '').backgroundColor", "green"); |
| 115 </script> | 115 </script> |
| OLD | NEW |