1
Fork 0
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:
Karol Kosek 2023-01-28 20:33:36 +01:00 committed by Andreas Kling
parent 2cc108a15e
commit 01e2cc5330
3 changed files with 9 additions and 1 deletions

View file

@ -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)