mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:28:11 +00:00
LibWeb: Add DOM::Node::parent_or_shadow_host()
This is useful when you want to traverse across shadow boundaries.
This commit is contained in:
parent
d597626ea1
commit
2eddd74e85
2 changed files with 10 additions and 0 deletions
|
@ -259,4 +259,11 @@ void Node::inserted_into(Node&)
|
|||
set_needs_style_update(true);
|
||||
}
|
||||
|
||||
ParentNode* Node::parent_or_shadow_host()
|
||||
{
|
||||
if (is<ShadowRoot>(*this))
|
||||
return downcast<ShadowRoot>(*this).host();
|
||||
return downcast<ParentNode>(parent());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue