summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resize-observer/ordering.html
blob: 1cd9950c53499b61ab4a2b9f401c12223d8182a6 (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
<!doctype html>
<title>ResizeObserver and IntersectionObserver ordering</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
  async_test(function(t) {
    let sawResize = false;
    let sawIo = false;
    let resizeObserver = new ResizeObserver(t.step_func(function() {
      assert_false(sawIo, "ResizeObserver notification should be delivered before IntersectionObserver notification");
      sawResize = true;
      resizeObserver.disconnect();
    }));

    let io = new IntersectionObserver(t.step_func_done(function() {
      assert_true(sawResize, "IntersectionObserver notification should be delivered after ResizeObserver notification");
      sawIo = true;
      io.disconnect();
    }));

    resizeObserver.observe(document.documentElement);
    io.observe(document.documentElement);
  });
</script>