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

intersection-observer

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intersection-observer - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

33

intersection-observer-test.js

@@ -566,13 +566,8 @@ /**

var spy = sinon.spy();
io = new IntersectionObserver(spy);
io = new IntersectionObserver(spy, {root: rootEl});
runSequence([
function(done) {
rootEl.style.position = 'absolute';
rootEl.style.top = '0px';
rootEl.style.left = '0px';
rootEl.style.width = '0px';
rootEl.style.height = '0px';
rootEl.style.display = 'none';
io.observe(rootEl);
io.observe(targetEl1);
setTimeout(function() {

@@ -599,3 +594,3 @@ expect(spy.callCount).to.be(1);

function(done) {
rootEl.style.display = 'none';
parentEl.style.display = 'none';
setTimeout(function() {

@@ -609,2 +604,24 @@ expect(spy.callCount).to.be(3);

}, ASYNC_TIMEOUT);
},
function(done) {
parentEl.style.display = 'block';
setTimeout(function() {
expect(spy.callCount).to.be(4);
var records = sortRecords(spy.lastCall.args[0]);
expect(records.length).to.be(1);
expect(records[0].isIntersecting).to.be(true);
expect(records[0].intersectionRatio).to.be(1);
done();
}, ASYNC_TIMEOUT);
},
function(done) {
targetEl1.style.display = 'none';
setTimeout(function() {
expect(spy.callCount).to.be(5);
var records = sortRecords(spy.lastCall.args[0]);
expect(records.length).to.be(1);
expect(records[0].isIntersecting).to.be(false);
expect(records[0].intersectionRatio).to.be(0);
done();
}, ASYNC_TIMEOUT);
}

@@ -611,0 +628,0 @@ ], done);

@@ -371,3 +371,7 @@ /**

var parentRect = null;
var parentComputedStyle = window.getComputedStyle(parent);
// If the parent isn't displayed, an intersection can't happen.
if (parentComputedStyle.display == 'none') return;
// If we're at the root element, set parentRect to the already

@@ -386,3 +390,3 @@ // calculated rootRect. And since <body> and <html> cannot be clipped

else {
if (window.getComputedStyle(parent).overflow != 'visible') {
if (parentComputedStyle.overflow != 'visible') {
parentRect = getBoundingClientRect(parent);

@@ -389,0 +393,0 @@ }

{
"name": "intersection-observer",
"version": "0.3.2",
"version": "0.3.3",
"description": "A polyfill for IntersectionObserver",

@@ -5,0 +5,0 @@ "main": "intersection-observer",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc