mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +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
|
@ -167,7 +167,7 @@ DOMInterfaces = {
|
|||
|
||||
'Document': {
|
||||
'additionalTraits': ["crate::interfaces::DocumentHelpers"],
|
||||
'canGc': ['Close', 'CreateElement', 'CreateElementNS', 'ImportNode', 'SetTitle', 'Write', 'Writeln', 'CreateEvent', 'CreateRange', 'Open', 'Open_', 'CreateComment', 'CreateAttribute', 'CreateAttributeNS', 'CreateDocumentFragment', 'CreateTextNode', 'CreateCDATASection', 'CreateProcessingInstruction', 'Prepend', 'Append', 'ReplaceChildren', 'SetBgColor', 'SetFgColor', 'Fonts', 'ElementFromPoint', 'ElementsFromPoint', 'GetScrollingElement', 'ExitFullscreen', 'CreateExpression', 'CreateNSResolver', 'Evaluate', 'StyleSheets', 'Implementation', 'GetElementsByTagName', 'GetElementsByTagNameNS', 'GetElementsByClassName', 'AdoptNode', 'CreateNodeIterator', 'SetBody', 'GetElementsByName', 'Images', 'Embeds', 'Plugins', 'Links', 'Forms', 'Scripts', 'Anchors', 'Applets', 'Children', 'GetSelection'],
|
||||
'canGc': ['Close', 'CreateElement', 'CreateElementNS', 'ImportNode', 'SetTitle', 'Write', 'Writeln', 'CreateEvent', 'CreateRange', 'Open', 'Open_', 'CreateComment', 'CreateAttribute', 'CreateAttributeNS', 'CreateDocumentFragment', 'CreateTextNode', 'CreateCDATASection', 'CreateProcessingInstruction', 'Prepend', 'Append', 'ReplaceChildren', 'SetBgColor', 'SetFgColor', 'Fonts', 'ElementFromPoint', 'ElementsFromPoint', 'GetScrollingElement', 'ExitFullscreen', 'CreateExpression', 'CreateNSResolver', 'Evaluate', 'StyleSheets', 'Implementation', 'GetElementsByTagName', 'GetElementsByTagNameNS', 'GetElementsByClassName', 'AdoptNode', 'CreateNodeIterator', 'SetBody', 'GetElementsByName', 'Images', 'Embeds', 'Plugins', 'Links', 'Forms', 'Scripts', 'Anchors', 'Applets', 'Children', 'GetSelection', 'NamedGetter'],
|
||||
},
|
||||
|
||||
'DissimilarOriginWindow': {
|
||||
|
@ -671,6 +671,10 @@ DOMInterfaces = {
|
|||
'canGc': ['AddModule'],
|
||||
},
|
||||
|
||||
'XMLDocument': {
|
||||
'canGc': ['NamedGetter'],
|
||||
},
|
||||
|
||||
'XMLHttpRequest': {
|
||||
'canGc': ['Abort', 'GetResponseXML', 'Response', 'Send'],
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue