tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

observer-callback-arguments.html (893B)


      1 <!DOCTYPE HTML>
      2 <meta charset=utf-8>
      3 <title>IntersectionObserver: callback arguments</title>
      4 <link rel="help" href="https://w3c.github.io/IntersectionObserver/#notify-intersection-observers-algo">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <div id="log"></div>
      8 <script>
      9 "use strict";
     10 
     11 async_test(t => {
     12  const io = new IntersectionObserver(function(entries, observer) {
     13    t.step(() => {
     14      assert_equals(this, io);
     15      assert_equals(arguments.length, 2);
     16      assert_true(Array.isArray(entries));
     17      assert_equals(entries.length, 1);
     18      assert_true(entries[0] instanceof IntersectionObserverEntry);
     19      assert_equals(observer, io);
     20 
     21      io.disconnect();
     22      t.done();
     23    });
     24  });
     25 
     26  io.observe(document.body);
     27 }, "Callback is invoked with |this| value of IntersectionObserver and two arguments");
     28 </script>