mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
LibWeb: Make factory method of DOM::HTMLCollection fallible
This commit is contained in:
parent
c120c46acc
commit
ff875d353b
Notes:
sideshowbarker
2024-07-17 00:12:25 +09:00
Author: https://github.com/kennethmyhra
Commit: ff875d353b
Pull-request: https://github.com/SerenityOS/serenity/pull/17491
Reviewed-by: https://github.com/linusg ✅
9 changed files with 28 additions and 28 deletions
|
@ -96,7 +96,7 @@ JS::NonnullGCPtr<HTMLCollection> ParentNode::children()
|
|||
if (!m_children) {
|
||||
m_children = HTMLCollection::create(*this, [this](Element const& element) {
|
||||
return is_parent_of(element);
|
||||
});
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
return *m_children;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ JS::NonnullGCPtr<HTMLCollection> ParentNode::get_elements_by_tag_name(Deprecated
|
|||
if (qualified_name == "*") {
|
||||
return HTMLCollection::create(*this, [](Element const&) {
|
||||
return true;
|
||||
});
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// 2. Otherwise, if root’s node document is an HTML document, return a HTMLCollection rooted at root, whose filter matches the following descendant elements:
|
||||
|
@ -121,13 +121,13 @@ JS::NonnullGCPtr<HTMLCollection> ParentNode::get_elements_by_tag_name(Deprecated
|
|||
|
||||
// - Whose namespace is not the HTML namespace and whose qualified name is qualifiedName.
|
||||
return element.qualified_name() == qualified_name;
|
||||
});
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// 3. Otherwise, return a HTMLCollection rooted at root, whose filter matches descendant elements whose qualified name is qualifiedName.
|
||||
return HTMLCollection::create(*this, [qualified_name](Element const& element) {
|
||||
return element.qualified_name() == qualified_name;
|
||||
});
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-getelementsbytagnamens
|
||||
|
@ -143,27 +143,27 @@ JS::NonnullGCPtr<HTMLCollection> ParentNode::get_elements_by_tag_name_ns(Depreca
|
|||
if (namespace_ == "*" && local_name == "*") {
|
||||
return HTMLCollection::create(*this, [](Element const&) {
|
||||
return true;
|
||||
});
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// 3. Otherwise, if namespace is "*" (U+002A), return a HTMLCollection rooted at root, whose filter matches descendant elements whose local name is localName.
|
||||
if (namespace_ == "*") {
|
||||
return HTMLCollection::create(*this, [local_name](Element const& element) {
|
||||
return element.local_name() == local_name;
|
||||
});
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// 4. Otherwise, if localName is "*" (U+002A), return a HTMLCollection rooted at root, whose filter matches descendant elements whose namespace is namespace.
|
||||
if (local_name == "*") {
|
||||
return HTMLCollection::create(*this, [namespace_](Element const& element) {
|
||||
return element.namespace_() == namespace_;
|
||||
});
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// 5. Otherwise, return a HTMLCollection rooted at root, whose filter matches descendant elements whose namespace is namespace and local name is localName.
|
||||
return HTMLCollection::create(*this, [namespace_, local_name](Element const& element) {
|
||||
return element.namespace_() == namespace_ && element.local_name() == local_name;
|
||||
});
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-parentnode-prepend
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue