Skip to content

Commit

Permalink
Fix intersection observer margin to absolute for non-document-root su…
Browse files Browse the repository at this point in the history
…pporting cases (#30871)
  • Loading branch information
Dima Voytenko committed Oct 27, 2020
1 parent 2b20794 commit 03eec1c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/service/loading-indicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export class LoadingIndicatorImpl {
inViewport
);
const iframed = isIframed(win);
const rootMargin = '25%';
// Classic IntersectionObserver doesn't support viewport tracking and
// rootMargin in x-origin iframes (#25428). As of 1/2020, only Chrome 81+
// supports it via {root: document}, which throws on other browsers.
Expand All @@ -68,12 +67,9 @@ export class LoadingIndicatorImpl {
: null);
let io;
try {
io = new win.IntersectionObserver(ioCallback, {
root,
rootMargin,
});
io = new win.IntersectionObserver(ioCallback, {root, rootMargin: '25%'});
} catch (e) {
io = new win.IntersectionObserver(ioCallback, {rootMargin});
io = new win.IntersectionObserver(ioCallback, {rootMargin: '150px'});
}
/** @private @const {!IntersectionObserver} */
this.io_ = io;
Expand Down

0 comments on commit 03eec1c

Please sign in to comment.