LibWeb: Add Element::is_document_element() helper

This is *not* the same as `Node::is_document()`, just to be confusing.
It basically means it's the root element.
This commit is contained in:
Sam Atkins 2023-08-12 17:47:33 +01:00 committed by Andreas Kling
parent 7690f76f92
commit 9f83c0f0da
Notes: sideshowbarker 2024-07-17 00:57:24 +09:00
2 changed files with 7 additions and 0 deletions

View File

@ -639,6 +639,12 @@ bool Element::is_target() const
return document().target_element() == this;
}
// https://dom.spec.whatwg.org/#document-element
bool Element::is_document_element() const
{
return document().document_element() == this;
}
JS::NonnullGCPtr<HTMLCollection> Element::get_elements_by_class_name(DeprecatedFlyString const& class_names)
{
Vector<FlyString> list_of_class_names;

View File

@ -169,6 +169,7 @@ public:
bool is_focused() const;
bool is_active() const;
bool is_target() const;
bool is_document_element() const;
JS::NonnullGCPtr<HTMLCollection> get_elements_by_class_name(DeprecatedFlyString const&);