mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Previously, the iframe's load event could fire during HTML parsing, before the test had started running. We now create the iframe in JS and append it to the document so that callbacks are executed in the correct order.
34 lines
902 B
HTML
34 lines
902 B
HTML
<!DOCTYPE html>
|
|
<style>
|
|
body { margin: 0; height: 2000px; }
|
|
iframe {
|
|
position: absolute;
|
|
top: 100px;
|
|
left: 50px;
|
|
width: 200px;
|
|
height: 200px;
|
|
border: none;
|
|
}
|
|
</style>
|
|
<script src="include.js"></script>
|
|
<script>
|
|
asyncTest((done) => {
|
|
window.reportClick = function(x, y) {
|
|
println(`click at (${x}, ${y})`);
|
|
done();
|
|
};
|
|
const iframe = document.createElement("iframe");
|
|
iframe.onload = () => {
|
|
window.scrollTo(0, 50);
|
|
internals.click(60, 60);
|
|
};
|
|
iframe.srcdoc = `
|
|
<!DOCTYPE html>
|
|
<style>body { margin: 0; }</style>
|
|
<div style='width: 100px; height: 100px'
|
|
onclick='parent.reportClick(event.clientX, event.clientY)'></div>
|
|
`;
|
|
document.body.appendChild(iframe);
|
|
});
|
|
</script>
|