LibWeb: Limit usage of getElementById() cache to connected roots

Fixes bug when we always return null from getElementById() on
unconnected roots because id to element cache is only maintained for
connected roots.

Fixes broken Perf-Dashboard suite in Speedometer 3.
This commit is contained in:
Aliaksandr Kalenik 2025-04-06 02:28:18 +02:00 committed by Alexander Kalenik
commit d5edd62e57
Notes: github-actions[bot] 2025-04-06 02:15:27 +00:00
3 changed files with 24 additions and 8 deletions

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<body></body>
<script src="../include.js"></script>
<script>
test(() => {
let host = document.createElement("div");
let shadow = host.attachShadow({ mode: "open" });
shadow.innerHTML = `<p id="foo">Hello</p><span id="bar">World</span>`;
let foo = shadow.getElementById("foo");
let bar = shadow.getElementById("bar");
println(foo.textContent + bar.textContent);
});
</script>