mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 00:51:33 +00:00
LibWeb: Make Node::parent_element() an inline function
Also remove a redundant verify_cast<Element> while we're here.
This commit is contained in:
parent
d7e2894e57
commit
b40f0415ef
|
@ -454,6 +454,22 @@ private:
|
|||
template<>
|
||||
inline bool Node::fast_is<Element>() const { return is_element(); }
|
||||
|
||||
inline Element* Node::parent_element()
|
||||
{
|
||||
auto* parent = this->parent();
|
||||
if (!parent || !is<Element>(parent))
|
||||
return nullptr;
|
||||
return static_cast<Element*>(parent);
|
||||
}
|
||||
|
||||
inline Element const* Node::parent_element() const
|
||||
{
|
||||
auto const* parent = this->parent();
|
||||
if (!parent || !is<Element>(parent))
|
||||
return nullptr;
|
||||
return static_cast<Element const*>(parent);
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm&, Optional<FlyString> namespace_, FlyString const& qualified_name);
|
||||
|
||||
}
|
||||
|
|
|
@ -330,20 +330,6 @@ bool Node::is_connected() const
|
|||
return shadow_including_root().is_document();
|
||||
}
|
||||
|
||||
Element* Node::parent_element()
|
||||
{
|
||||
if (!parent() || !is<Element>(parent()))
|
||||
return nullptr;
|
||||
return verify_cast<Element>(parent());
|
||||
}
|
||||
|
||||
Element const* Node::parent_element() const
|
||||
{
|
||||
if (!parent() || !is<Element>(parent()))
|
||||
return nullptr;
|
||||
return verify_cast<Element>(parent());
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
|
||||
WebIDL::ExceptionOr<void> Node::ensure_pre_insertion_validity(JS::NonnullGCPtr<Node> node, JS::GCPtr<Node> child) const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue