UNPKG

495 BJavaScriptView Raw
1"use strict";
2
3const {getIntersectionRatio} = require("./intersectionCalc");
4
5module.exports = function FakeIntersectionObserverEntry(browser) {
6 return IntersectionObserverEntry;
7
8 function IntersectionObserverEntry(element, rootMargin) {
9 const boundingClientRect = element.getBoundingClientRect();
10 const intersectionRatio = getIntersectionRatio(boundingClientRect, browser.window.innerHeight, rootMargin);
11
12 return {target: element, boundingClientRect, intersectionRatio};
13 }
14};