From f4c4d3c7804ac47986e9dcf6aa423fe92e61b3b8 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Wed, 26 Feb 2025 12:48:57 +0000 Subject: [PATCH] LibWeb/SVG: Process script element when `href` attribute changes --- Libraries/LibWeb/SVG/SVGScriptElement.cpp | 8 ++++++++ Libraries/LibWeb/SVG/SVGScriptElement.h | 1 + 2 files changed, 9 insertions(+) diff --git a/Libraries/LibWeb/SVG/SVGScriptElement.cpp b/Libraries/LibWeb/SVG/SVGScriptElement.cpp index 6b619509ae9..b70e68d38a5 100644 --- a/Libraries/LibWeb/SVG/SVGScriptElement.cpp +++ b/Libraries/LibWeb/SVG/SVGScriptElement.cpp @@ -35,6 +35,14 @@ void SVGScriptElement::visit_edges(Cell::Visitor& visitor) visitor.visit(m_script); } +void SVGScriptElement::attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) +{ + Base::attribute_changed(name, old_value, value, namespace_); + if (name == SVG::AttributeNames::href) { + process_the_script_element(); + } +} + void SVGScriptElement::inserted() { Base::inserted(); diff --git a/Libraries/LibWeb/SVG/SVGScriptElement.h b/Libraries/LibWeb/SVG/SVGScriptElement.h index 941b5a39b40..2bc579fee89 100644 --- a/Libraries/LibWeb/SVG/SVGScriptElement.h +++ b/Libraries/LibWeb/SVG/SVGScriptElement.h @@ -26,6 +26,7 @@ public: virtual void inserted() override; virtual void children_changed(ChildrenChangedMetadata const*) override; + virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; protected: SVGScriptElement(DOM::Document&, DOM::QualifiedName);