Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
heycam authored and SkyBlack1225 committed Nov 1, 2023
1 parent 00fbcb9 commit 1063749
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions css/selectors/invalidation/input-pseudo-classes-in-has.html
Expand Up @@ -16,6 +16,7 @@
.ancestor:has(#numberinput:out-of-range) { color: darkgreen }
.ancestor:has(#numberinput:required) { color: pink }
.ancestor:has(#progress:indeterminate) { color: orange }
.ancestor:has(#checkboxinput:default) { color: purple; }
</style>
<div id=subject class=ancestor>
<input type="checkbox" name="my-checkbox" id="checkme">
Expand All @@ -24,6 +25,7 @@
<input id="radioinput" checked>
<input id="numberinput" type="number" min="1" max="10" value="5">
<progress id="progress" value="50" max="100"></progress>
<input id="checkboxinput" type="checkbox">
</div>
<script>
test(function() {
Expand Down Expand Up @@ -138,4 +140,25 @@
assert_equals(getComputedStyle(subject).color, "rgb(0, 0, 128)",
"ancestor should be navy");
}, ":placeholder-shown invalidation");

test(function() {
this.add_cleanup(() => {
checkboxinput.checked = false;
checkboxinput.removeAttribute("checked");
});
assert_equals(getComputedStyle(subject).color, "rgb(0, 0, 0)",
"ancestor should be black");
checkboxinput.checked = true;
assert_equals(getComputedStyle(subject).color, "rgb(0, 0, 0)",
"ancestor should still be black");
checkboxinput.setAttribute("checked", "");
assert_equals(getComputedStyle(subject).color, "rgb(128, 0, 128)",
"ancestor should be purple");
checkboxinput.checked = false;
assert_equals(getComputedStyle(subject).color, "rgb(128, 0, 128)",
"ancestor should still be purple");
checkboxinput.removeAttribute("checked");
assert_equals(getComputedStyle(subject).color, "rgb(0, 0, 0)",
"ancestor should be black");
}, ":default invalidation with input[type=checkbox] and assignment to .checked");
</script>

0 comments on commit 1063749

Please sign in to comment.