mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb: Ensure document.getElementsByClassName("")
returns no elements
Previously, `document.getElementsByClassName("")` would return a collection containing all elements in the given document.
This commit is contained in:
parent
faf64bfb41
commit
0fceede029
Notes:
github-actions[bot]
2024-07-23 06:59:20 +00:00
Author: https://github.com/tcl3
Commit: 0fceede029
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/773
4 changed files with 23 additions and 10 deletions
|
@ -234,10 +234,10 @@ JS::NonnullGCPtr<HTMLCollection> ParentNode::get_elements_by_class_name(StringVi
|
|||
}
|
||||
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;
|
||||
if (element.has_class(name, quirks_mode ? CaseSensitivity::CaseInsensitive : CaseSensitivity::CaseSensitive))
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue