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:
parent
7690f76f92
commit
9f83c0f0da
Notes:
sideshowbarker
2024-07-17 00:57:24 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/9f83c0f0da Pull-request: https://github.com/SerenityOS/serenity/pull/20593 Reviewed-by: https://github.com/awesomekling
2 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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&);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue