Blame dom/base/test/intersectionobserver_window.html

Packit f0b94e
Packit f0b94e
<html>
Packit f0b94e
<head>
Packit f0b94e
<style>
Packit f0b94e
#target5 {
Packit f0b94e
        position: absolute;
Packit f0b94e
        top: 0px;
Packit f0b94e
        left: 0px;
Packit f0b94e
        width: 20px;
Packit f0b94e
        height: 20px;
Packit f0b94e
        background: #f00;
Packit f0b94e
}
Packit f0b94e
</style>
Packit f0b94e
<body>
Packit f0b94e
Packit f0b94e
<script>
Packit f0b94e
        var io = new IntersectionObserver(function(records) {
Packit f0b94e
          var viewportWidth =
Packit f0b94e
              document.documentElement.clientWidth || document.body.clientWidth;
Packit f0b94e
          var viewportHeight =
Packit f0b94e
              document.documentElement.clientHeight || document.body.clientHeight;
Packit f0b94e
          var result = records.length === 1 &&
Packit f0b94e
                       records[0].rootBounds.top === 0 &&
Packit f0b94e
                       records[0].rootBounds.left === 0 &&
Packit f0b94e
                       records[0].rootBounds.right === viewportWidth &&
Packit f0b94e
                       records[0].rootBounds.width === viewportWidth &&
Packit f0b94e
                       records[0].rootBounds.bottom === viewportHeight &&
Packit f0b94e
                       records[0].rootBounds.height === viewportHeight;
Packit f0b94e
          if (!result) {
Packit f0b94e
              result = [records.length,
Packit f0b94e
                        records[0].isIntersecting,
Packit f0b94e
                        records[0].rootBounds.top,
Packit f0b94e
                        records[0].rootBounds.left,
Packit f0b94e
                        records[0].rootBounds.right,
Packit f0b94e
                        records[0].rootBounds.width,
Packit f0b94e
                        records[0].rootBounds.bottom,
Packit f0b94e
                        records[0].rootBounds.height,
Packit f0b94e
                        viewportWidth,
Packit f0b94e
                        viewportHeight].join(',');
Packit f0b94e
          }
Packit f0b94e
          window.opener.postMessage(result, '*');
Packit f0b94e
        });
Packit f0b94e
        io.observe(document.getElementById("target"));
Packit f0b94e
</script>
Packit f0b94e
</body>
Packit f0b94e
</html>