Don't count <img> elements with both name and id twice in document's named getter (#37455)

A document's named getter collects elements with either matching name or
id's (varies per element type) and returns them .

We implement this the following way:
* Create an iterator with elements whose `name` attribute matches
* Create an iterator with elements whose `id` attribute matches
* Concatenate both

The spec then asks us if there is more than one element in the list,
which we implement by checking whether the iterator returns `None` after
we get the first element. However, the same element can appear in both
iterators if it is a `img` element and both it's name and id attribute
match. Therefore, we need to check if there are more elements *which are
not equal to the first one*.

Testing: New web platform tests pass

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-06-15 20:54:53 +02:00 committed by GitHub
parent ae20cdbdc9
commit 9d10e41a1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 21 deletions

View file

@ -1,9 +0,0 @@
[nameditem-01.html]
[img elements that have a name and id attribute with same value.]
expected: FAIL
[Dynamically updating the name attribute from img elements, should be accessible by values.]
expected: FAIL
[Dynamically updating the id attribute from img elements, should be accessible by values.]
expected: FAIL