summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/selectors/invalidation/subject-has-invalidation-with-display-none-anchor-element.html
blob: 6c87560c691c7ee21f613b531e0209600939e495 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<meta charset="utf-8" />
<title>CSS Selectors Invalidation: subject :has() invalidation with display: none anchor element</title>
<link rel="author" title="Byungwoo Lee" href="blee@igalia.com">
<link rel="help" href="https://drafts.csswg.org/selectors/#relational">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
  #target:has(~ input:checked) { display: none; }
</style>
<p>Click checkbox</p>
<div id="target">PASS</div>
<input type="checkbox" id="checkme">
<label for="checkme">Check me!</label>
<script>
  test(function() {
    checkme.checked = false;
    assert_equals(getComputedStyle(target).display, "block",
                  "target display should be empty");

    checkme.checked = true;
    assert_equals(getComputedStyle(target).display, "none",
                  "target display should be none");

    checkme.checked = false;
    assert_equals(getComputedStyle(target).display, "block",
                  "target display should be empty again");
  });
</script>