ladybird/Tests/LibWeb/Text/input/HTML/document-named-shenanigans.html
Andreas Kling 12f5e9c5f8 LibWeb: Only put connected elements into document's by-name-or-id cache
This fixes an issue where disconnected elements were incorrectly
accessible as named properties on the document.
2025-03-04 00:51:50 +01:00

64 lines
1.4 KiB
HTML

<script src="../include.js"></script>
<script>
function go(tagName) {
println("Testing <" + tagName + "> element");
let a = [];
let e = document.createElement(tagName);
a.push(document.shenanigans);
e.setAttribute("name", "shenanigans");
a.push(document.shenanigans);
e.setAttribute("name", "mischief");
a.push(document.shenanigans);
a.push(document.mischief);
e.name = "shenanigans";
a.push(document.shenanigans);
a.push(document.mischief);
document.body.appendChild(e);
a.push(document.shenanigans);
e.remove();
a.push(document.shenanigans);
document.body.appendChild(e);
a.push(document.shenanigans);
e.removeAttribute("name");
a.push(document.hijinks);
e.setAttribute("id", "hijinks");
a.push(document.hijinks);
document.body.appendChild(e);
a.push(document.hijinks);
e.remove();
a.push(document.hijinks);
document.body.appendChild(e);
a.push(document.hijinks);
e.removeAttribute("id");
a.push(document.hijinks);
e.remove();
a.push(document.hijinks);
println(a);
println("");
}
test(() => {
go("div");
go("form");
go("img");
go("embed");
go("object");
});
</script>