mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibWeb: Move get_elements_by_name implementation to ParentNode
Previously, we had two implementations of the same function in `Document` and `Element`, which had inadvertantly diverged.
This commit is contained in:
parent
f666d967d6
commit
faf64bfb41
Notes:
github-actions[bot]
2024-07-23 06:59:24 +00:00
Author: https://github.com/tcl3
Commit: faf64bfb41
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/773
6 changed files with 18 additions and 33 deletions
|
@ -1401,21 +1401,6 @@ JS::NonnullGCPtr<HTMLCollection> Document::get_elements_by_name(FlyString const&
|
|||
});
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<HTMLCollection> Document::get_elements_by_class_name(StringView class_names)
|
||||
{
|
||||
Vector<FlyString> list_of_class_names;
|
||||
for (auto& name : class_names.split_view(' ')) {
|
||||
list_of_class_names.append(FlyString::from_utf8(name).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
return HTMLCollection::create(*this, HTMLCollection::Scope::Descendants, [list_of_class_names = move(list_of_class_names), quirks_mode = document().in_quirks_mode()](Element const& element) {
|
||||
for (auto& name : list_of_class_names) {
|
||||
if (!element.has_class(name, quirks_mode ? CaseSensitivity::CaseInsensitive : CaseSensitivity::CaseSensitive))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/obsolete.html#dom-document-applets
|
||||
JS::NonnullGCPtr<HTMLCollection> Document::applets()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue