1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:47:46 +00:00

LibWeb: Port Element interface from DeprecatedString

This is the last IDL interface which was using DeprecatedString! :^)
This commit is contained in:
Shannon Booth 2023-10-06 07:43:52 +13:00 committed by Andreas Kling
parent 274e0f4988
commit 4321606bba
12 changed files with 295 additions and 251 deletions

View file

@ -146,20 +146,20 @@ JS::NonnullGCPtr<HTMLCollection> ParentNode::get_elements_by_tag_name(Deprecated
// 2. Otherwise, if roots node document is an HTML document, return a HTMLCollection rooted at root, whose filter matches the following descendant elements:
if (root().document().document_type() == Document::Type::HTML) {
auto qualified_name_in_ascii_lowercase = qualified_name.to_lowercase();
auto qualified_name_in_ascii_lowercase = MUST(FlyString::from_deprecated_fly_string(qualified_name.to_lowercase()));
return HTMLCollection::create(*this, HTMLCollection::Scope::Descendants, [qualified_name, qualified_name_in_ascii_lowercase](Element const& element) {
// - Whose namespace is the HTML namespace and whose qualified name is qualifiedName, in ASCII lowercase.
if (element.namespace_() == Namespace::HTML)
return element.qualified_name() == qualified_name_in_ascii_lowercase;
// - Whose namespace is not the HTML namespace and whose qualified name is qualifiedName.
return element.qualified_name() == qualified_name;
return element.qualified_name().to_deprecated_fly_string() == qualified_name;
});
}
// 3. Otherwise, return a HTMLCollection rooted at root, whose filter matches descendant elements whose qualified name is qualifiedName.
return HTMLCollection::create(*this, HTMLCollection::Scope::Descendants, [qualified_name](Element const& element) {
return element.qualified_name() == qualified_name;
return element.qualified_name().to_deprecated_fly_string() == qualified_name;
});
}