mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:17:45 +00:00
LibWeb: Add a helper function for checking if element is a shadow host
This commit is contained in:
parent
2cc108a15e
commit
01e2cc5330
3 changed files with 9 additions and 1 deletions
|
@ -537,6 +537,13 @@ JS::NonnullGCPtr<HTMLCollection> Element::get_elements_by_class_name(DeprecatedF
|
|||
});
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#element-shadow-host
|
||||
bool Element::is_shadow_host() const
|
||||
{
|
||||
// An element is a shadow host if its shadow root is non-null.
|
||||
return m_shadow_root != nullptr;
|
||||
}
|
||||
|
||||
void Element::set_shadow_root(JS::GCPtr<ShadowRoot> shadow_root)
|
||||
{
|
||||
if (m_shadow_root == shadow_root)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue