mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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:
parent
ae20cdbdc9
commit
9d10e41a1a
4 changed files with 21 additions and 21 deletions
|
@ -122,7 +122,7 @@ impl XMLDocumentMethods<crate::DomTypeHolder> for XMLDocument {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
|
||||
fn NamedGetter(&self, name: DOMString) -> Option<NamedPropertyValue> {
|
||||
self.upcast::<Document>().NamedGetter(name)
|
||||
fn NamedGetter(&self, name: DOMString, can_gc: CanGc) -> Option<NamedPropertyValue> {
|
||||
self.upcast::<Document>().NamedGetter(name, can_gc)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue