mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 07:37:03 +00:00
LibWeb: Only return HTML elements from getElementsByName()
Fixes two WPT tests: document.getElementsByName-namespace-xhtml.xhtml and document.getElementsByName-namespace.html
This commit is contained in:
parent
d5fd29adb7
commit
917a2a3c86
Notes:
github-actions[bot]
2024-10-14 16:00:15 +00:00
Author: https://github.com/ronak69
Commit: 917a2a3c86
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1791
3 changed files with 25 additions and 2 deletions
|
@ -1488,12 +1488,13 @@ void Document::set_hovered_node(Node* node)
|
|||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#dom-document-getelementsbyname
|
||||
JS::NonnullGCPtr<NodeList> Document::get_elements_by_name(FlyString const& name)
|
||||
{
|
||||
return LiveNodeList::create(realm(), *this, LiveNodeList::Scope::Descendants, [name](auto const& node) {
|
||||
if (!is<Element>(node))
|
||||
if (!is<HTML::HTMLElement>(node))
|
||||
return false;
|
||||
return verify_cast<Element>(node).name() == name;
|
||||
return verify_cast<HTML::HTMLElement>(node).name() == name;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue