intersection-observer
Advanced tools
@@ -145,3 +145,3 @@ /** | ||
io = new IntersectionObserver(noop, {threshold: ['foo']}); | ||
}).to.throwException(/threshold/i); | ||
}).to.throwException(); | ||
}); | ||
@@ -153,3 +153,3 @@ | ||
io = new IntersectionObserver(noop, {threshold: [0, -1]}); | ||
}).to.throwException(/threshold/i); | ||
}).to.throwException(); | ||
}); | ||
@@ -166,3 +166,3 @@ | ||
io.observe(null); | ||
}).to.throwException(/element/i); | ||
}).to.throwException(); | ||
}); | ||
@@ -184,3 +184,17 @@ | ||
it('triggers for existing targets when observing begins after monitoring has begun', function(done) { | ||
var spy = sinon.spy(); | ||
io = new IntersectionObserver(spy, {root: rootEl}); | ||
io.observe(targetEl1); | ||
setTimeout(function() { | ||
io.observe(targetEl2); | ||
setTimeout(function() { | ||
expect(spy.callCount).to.be(2); | ||
done(); | ||
}, ASYNC_TIMEOUT); | ||
}, ASYNC_TIMEOUT); | ||
}); | ||
it('triggers with the correct arguments', function(done) { | ||
@@ -187,0 +201,0 @@ io = new IntersectionObserver(function(records, observer) { |
@@ -155,2 +155,3 @@ /** | ||
this._monitorIntersections(); | ||
this._checkForIntersections(); | ||
}; | ||
@@ -260,4 +261,2 @@ | ||
this._checkForIntersections(); | ||
// If a poll interval is set, use polling instead of listening to | ||
@@ -264,0 +263,0 @@ // resize and scroll events or DOM mutations. |
{ | ||
"name": "intersection-observer", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "A polyfill for IntersectionObserver", | ||
@@ -5,0 +5,0 @@ "main": "intersection-observer", |
Sorry, the diff of this file is not supported yet
67911
0.59%1548
0.78%