summaryrefslogtreecommitdiffstats
path: root/dom/events/test/test_unbound_before_in_active_chain.html
blob: b62d44bb31ba9e9ae6579bc4880e24558bf638ee (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
30
31
32
33
34
35
36
37
38
<!doctype html>
<title>Test for bug 1489139: Unbound generated content in the active chain</title>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<style>
#target, #target::before {
  width: 200px;
  height: 200px;
}

#target::before {
  content: " ";
  display: block;
  background: green;
}

#target:active::before {
  content: "";
  background: red;
}
</style>
Should see a green square after clicking.
<div id="target"></div>
<script>
SimpleTest.waitForExplicitFinish();
onload = function() {
  let target = document.getElementById("target");
  requestAnimationFrame(() => {
    synthesizeMouseAtPoint(100, 100, { type: "mousedown" })
    ok(target.matches(":active"), "Should have been clicked");
    requestAnimationFrame(() => {
      synthesizeMouseAtPoint(100, 100, { type: "mouseup" })
      ok(!target.matches(':active'), "Should stop matching :active afterwards");
      SimpleTest.finish();
    });
  });
}
</script>