1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:47:45 +00:00

LibWeb: Make Element::set_shadow_root() disconnect any previous root

This commit is contained in:
Andreas Kling 2022-03-16 00:26:40 +01:00
parent d2a99eded7
commit b1096c2ae4
4 changed files with 7 additions and 4 deletions

View file

@ -382,8 +382,11 @@ void Element::set_shadow_root(RefPtr<ShadowRoot> shadow_root)
{
if (m_shadow_root == shadow_root)
return;
if (m_shadow_root)
m_shadow_root->set_host(nullptr);
m_shadow_root = move(shadow_root);
m_shadow_root->set_host(*this);
if (m_shadow_root)
m_shadow_root->set_host(this);
invalidate_style();
}