LibWeb: Make getElementById() always return first match in tree order

We had a const and non-const version of this function, with slightly
different behavior (oops!)

This patch consolidates the implementations and keeps only the correct
behavior in there.

Fixes an issue where comments were not collapsible on Hacker News.
This commit is contained in:
Andreas Kling 2024-07-21 11:43:59 +02:00 committed by Tim Ledbetter
commit 98f88d49de
Notes: github-actions[bot] 2024-07-21 11:26:29 +00:00
3 changed files with 11 additions and 16 deletions

View file

@ -0,0 +1,7 @@
<div id="foo" n="1"></div><div id="foo" n="2"></div>
<script src="../include.js"></script>
<script>
test(() => {
println("getElementById('foo') => " + document.getElementById("foo").getAttribute("n"));
});
</script>