ladybird/Tests/LibWeb/Text/input/HTML/beforeunload.html
Timothy Flynn 13b7355ec1 LibWeb: Move some classes from the DOM namespace to the HTML namespace
The following classes are in the HTML spec and thus belong in the HTML
namespace:

* BeforeUnloadEvent
* HTMLFormControlsCollection
* RadioNodeList
2024-11-02 11:16:45 -04:00

20 lines
588 B
HTML

<script src="../include.js"></script>
<script>
asyncTest(done => {
const iframe = document.createElement("iframe");
document.body.appendChild(iframe);
iframe.contentWindow.addEventListener("beforeunload", e => {
println("Before unload event fired");
e.preventDefault();
println(`Default prevented: ${e.defaultPrevented}`);
});
iframe.addEventListener("load", e => {
println(`iframe load: ${e.target.src}`);
done();
});
iframe.src = "about:blank";
});
</script>