New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-lazyload

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-lazyload - npm Package Compare versions

Comparing version

to
2.6.2

18

lib/index.js

@@ -76,3 +76,5 @@ 'use strict';

var parentTop = void 0;
var parentLeft = void 0;
var parentHeight = void 0;
var parentWidth = void 0;

@@ -83,17 +85,26 @@ try {

parentTop = _parent$getBoundingCl.top;
parentLeft = _parent$getBoundingCl.left;
parentHeight = _parent$getBoundingCl.height;
parentWidth = _parent$getBoundingCl.width;
} catch (e) {
parentTop = defaultBoundingClientRect.top;
parentLeft = defaultBoundingClientRect.left;
parentHeight = defaultBoundingClientRect.height;
parentWidth = defaultBoundingClientRect.width;
}
var windowInnerHeight = window.innerHeight || document.documentElement.clientHeight;
var windowInnerWidth = window.innerWidth || document.documentElement.clientWidth;
// calculate top and height of the intersection of the element's scrollParent and viewport
var intersectionTop = Math.max(parentTop, 0); // intersection's top relative to viewport
var intersectionLeft = Math.max(parentLeft, 0); // intersection's left relative to viewport
var intersectionHeight = Math.min(windowInnerHeight, parentTop + parentHeight) - intersectionTop; // height
var intersectionWidth = Math.min(windowInnerWidth, parentLeft + parentWidth) - intersectionLeft; // width
// check whether the element is visible in the intersection
var top = void 0;
var left = void 0;
var height = void 0;
var width = void 0;

@@ -104,13 +115,18 @@ try {

top = _node$getBoundingClie.top;
left = _node$getBoundingClie.left;
height = _node$getBoundingClie.height;
width = _node$getBoundingClie.width;
} catch (e) {
top = defaultBoundingClientRect.top;
left = defaultBoundingClientRect.left;
height = defaultBoundingClientRect.height;
width = defaultBoundingClientRect.width;
}
var offsetTop = top - intersectionTop; // element's top relative to intersection
var offsetLeft = left - intersectionLeft; // element's left relative to intersection
var offsets = Array.isArray(component.props.offset) ? component.props.offset : [component.props.offset, component.props.offset]; // Be compatible with previous API
return offsetTop - offsets[0] <= intersectionHeight && offsetTop + height + offsets[1] >= 0;
return offsetTop - offsets[0] <= intersectionHeight && offsetTop + height + offsets[1] >= 0 && offsetLeft - offsets[0] <= intersectionWidth && offsetLeft + width + offsets[1] >= 0;
};

@@ -117,0 +133,0 @@

2

package.json
{
"name": "react-lazyload",
"version": "2.6.1",
"version": "2.6.2",
"description": "Lazyload your components, images or anything where performance matters.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",