mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibWeb: Look for first ID _or_ name in HTMLCollection::named_item
Previously we would look for a matching ID, and then for a matching name. If there was an element in the collection which had a matching ID as well as an element with a matching name, we would always return the element with a matching ID irrespective of what order that element was in.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 18:46:57 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/baaaa0008e Pull-request: https://github.com/SerenityOS/serenity/pull/24118 Reviewed-by: https://github.com/trflynn89 ✅
15
Tests/LibWeb/Text/input/DOM/HTMLCollection-order.html
Normal file
15
Tests/LibWeb/Text/input/DOM/HTMLCollection-order.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<a name="anchor1" id="foo"></a>
|
||||
<a name="anchor2" id="baz"></a>
|
||||
<a name="anchor3" id="anchor1"></a>
|
||||
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
println(document.anchors.constructor.name);
|
||||
println(document.anchors.namedItem('anchor1').name);
|
||||
println(document.anchors.namedItem('anchor2').name);
|
||||
println(document.anchors.namedItem('anchor3').name);
|
||||
println(document.anchors.namedItem('foo').name);
|
||||
println(document.anchors.namedItem('baz').name);
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user