1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 22:08:12 +00:00

LibWeb: Clean up shadow root of meter element

This commit is contained in:
Bastiaan van der Plaat 2023-12-05 21:17:46 +01:00 committed by Andreas Kling
parent 34fa49c344
commit ca94df3c88
2 changed files with 7 additions and 1 deletions

View file

@ -5,7 +5,6 @@
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/ShadowRoot.h> #include <LibWeb/DOM/ShadowRoot.h>
#include <LibWeb/HTML/HTMLMeterElement.h> #include <LibWeb/HTML/HTMLMeterElement.h>
@ -188,6 +187,11 @@ void HTMLMeterElement::inserted()
create_shadow_tree_if_needed(); create_shadow_tree_if_needed();
} }
void HTMLMeterElement::removed_from(DOM::Node*)
{
set_shadow_root(nullptr);
}
void HTMLMeterElement::create_shadow_tree_if_needed() void HTMLMeterElement::create_shadow_tree_if_needed()
{ {
if (shadow_root_internal()) if (shadow_root_internal())

View file

@ -41,6 +41,7 @@ public:
private: private:
CSS::Selector::PseudoElement m_pseudo_element; CSS::Selector::PseudoElement m_pseudo_element;
}; };
class HTMLMeterElement final : public HTMLElement { class HTMLMeterElement final : public HTMLElement {
WEB_PLATFORM_OBJECT(HTMLMeterElement, HTMLElement); WEB_PLATFORM_OBJECT(HTMLMeterElement, HTMLElement);
JS_DECLARE_ALLOCATOR(HTMLMeterElement); JS_DECLARE_ALLOCATOR(HTMLMeterElement);
@ -63,6 +64,7 @@ public:
// ^HTMLElement // ^HTMLElement
virtual void inserted() override; virtual void inserted() override;
virtual void removed_from(DOM::Node*) override;
// https://html.spec.whatwg.org/multipage/forms.html#category-label // https://html.spec.whatwg.org/multipage/forms.html#category-label
virtual bool is_labelable() const override { return true; } virtual bool is_labelable() const override { return true; }