1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 15:55:09 +00:00
serenity/Base/res/html/misc/checkbox.html
Andreas Kling b62043dbca LibWeb: Protect LayoutCheckBox against crashes after event dispatch
After dispatching a "change" event due to the checked state being
modified, we may have been removed from the layout tree.

Make LayoutCheckBox protect itself to prevent this from crashing.

Also, add a little test page for checkboxes. :^)
2020-09-11 18:42:43 +02:00

11 lines
330 B
HTML

<html>
<input id=foo type=checkbox> This is a checkbox
<pre id=bar></pre>
<script>
var foo = document.getElementById("foo");
var bar = document.getElementById("bar");
foo.addEventListener("change", function() {
bar.innerHTML += foo.checked + "\n";
});
</script>
</html>