MCPcopy Create free account
hub / github.com/ampproject/amphtml / fixEntry

Function fixEntry

src/polyfills/intersection-observer.js:44–63  ·  view source on GitHub ↗

@param {!Window} win

(win)

Source from the content-addressed store, hash-verified

42
43/** @param {!Window} win */
44function fixEntry(win) {
45 // Minimal polyfill for Edge 15's lack of `isIntersecting`
46 // See: https://github.com/w3c/IntersectionObserver/issues/211
47 if (
48 win.IntersectionObserverEntry &&
49 !('isIntersecting' in win.IntersectionObserverEntry.prototype)
50 ) {
51 Object.defineProperty(
52 win.IntersectionObserverEntry.prototype,
53 'isIntersecting',
54 {
55 enumerable: true,
56 configurable: true,
57 get() {
58 return this.intersectionRatio > 0;
59 },
60 }
61 );
62 }
63}

Callers 2

installFunction · 0.85
installForChildWinFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected