blob: 4dad2f33a5d118bbd938e1d2d83abc96273a1fe8 [file] [log] [blame]
All of the IntersectionObserver tests feature the following idiom:
<script>
var observer = new IntersectionObserver(...)
function test_function() {
var entries = observer.takeRecords();
// Verify entries
}
onload = function() {
observer.observe(target);
requestAnimationFrame(() => { requestAnimationFrame(test_function) });
}
Subsequent steps in the test use a single RAF to give the observer a chance to
generate notifications, but the double RAF is required in the onload handler.
Here's the chain of events:
- onload
- observer.observe()
- First RAF handler is registered
- BeginFrame
- RAF handlers run
- Second RAF handler is registered
- UpdateAllLifecyclePhases
- IntersectionObserver generates notifications
- BeginFrame
- RAF handlers run
- Second RAF handler verifies observer notifications.