mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
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.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
4110a05684
commit
88167149f6
Notes:
github-actions[bot]
2026-03-25 22:15:22 +00:00
Author: https://github.com/skyz1 Commit: https://github.com/LadybirdBrowser/ladybird/commit/88167149f6e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8602 Reviewed-by: https://github.com/gmta ✅
28
Tests/LibWeb/Text/input/HTML/command-detached.html
Normal file
28
Tests/LibWeb/Text/input/HTML/command-detached.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user