Files
ladybird/Tests/LibWeb/Text/input/HTML/command-detached.html
Glenn Skrzypczak 88167149f6 LibWeb/HTML: Properly get the attr-associated element
This replaces ad-hoc implementations of the get the attr-associated
element steps with a call to the proper implementation. This fixes
issue #8585.
2026-03-25 23:14:10 +01:00

29 lines
921 B
HTML

<!doctype html>
<script src="../include.js"></script>
<button id="button"></button>
<div id="target"></div>
<script>
test(() => {
const logEvent = e => println(`${e.command}: ${e.source.id} -> ${e.target.id}`);
target.addEventListener("command", logEvent);
const detachedTarget = document.createElement("div");
detachedTarget.id = "detachedTarget";
detachedTarget.addEventListener("command", logEvent);
const detachedButton = document.createElement("button");
detachedTarget.id = "detachedButton";
function testEvent(button, target) {
button.command = "--test";
button.commandForElement = target;
button.click();
}
testEvent(button, target);
testEvent(button, detachedTarget);
testEvent(detachedButton, target);
testEvent(detachedButton, detachedTarget);
});
</script>