mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Update web-platform-tests to revision d3cf77a7b8c20c678b725238eaa8a72eca3787ae
This commit is contained in:
parent
880f3b8b7a
commit
efca990ffe
541 changed files with 8000 additions and 2276 deletions
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
#target {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="target">target</div>
|
||||
|
||||
<script>
|
||||
var delay = 100;
|
||||
var results = [];
|
||||
|
||||
function waitForNotification(f) {
|
||||
setTimeout(() => {
|
||||
requestAnimationFrame(function () {
|
||||
requestAnimationFrame(function () {
|
||||
setTimeout(f)
|
||||
})
|
||||
})
|
||||
}, delay)
|
||||
}
|
||||
|
||||
window.addEventListener("message", event => {
|
||||
waitForNotification(() => {
|
||||
window.parent.postMessage(results.map(e => e.isVisible), "*");
|
||||
results = [];
|
||||
});
|
||||
});
|
||||
|
||||
onload = () => {
|
||||
var target = document.getElementById("target");
|
||||
var observer = new IntersectionObserver(entries => {
|
||||
results = entries;
|
||||
}, {trackVisibility: true, delay: delay});
|
||||
observer.observe(document.getElementById("target"));
|
||||
window.parent.postMessage("", "*");
|
||||
};
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue