w3c / IntersectionObserver

Intersection Observer
https://www.w3.org/TR/intersection-observer/
Other
3.62k stars 526 forks source link

rootRect without passed root parameter #440

Closed ZachBird closed 4 years ago

ZachBird commented 4 years ago

if not pass root parameter when create instance, dependence on mdn document

Defaults to the browser viewport if not specified or if null.

so, in 「_getRootRect」 function,if without 「this.root」, may the rootRect should be:

 rootRect = {
      top: 0,
      left: 0,
      right: window.innerWidth,
      width: window.innerWidth,
      bottom: window.innerHeight,
      height: window.innerHeight
};
szager-chromium commented 4 years ago

innerWidth/innerHeight represent the browser window's layout viewport. Issue #26 discusses whether the implicit root should be the layout viewport or the visual viewport, with the balance of opinion favoring the visual viewport. The IntersectionObserver spec needs to be updated, but I'm going to close this issue and attach any PR's to issue #26.