      requestAnimationFrame(() => {
        runStep1();
      });
    });
  }

  // Verify that all elements are visible at the start, with intersection events.
  function runStep1() {
    const step = arguments.callee.name;
    t.step(() => {
      assert_equals(entries.length, 4, step);
      // Clear the observed visible targets.
      for (let i = 0; i < entries.length; ++i) {
        assert_true(entries[i].isIntersecting);
        assert_true(entries[i].target === target1 ||
                    entries