diff --git a/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp index 7b3fffebb92..48ce441d92f 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp @@ -60,12 +60,19 @@ void SVGUseElement::attribute_changed(FlyString const& name, Optional co } else if (name == SVG::AttributeNames::y) { m_y = AttributeParser::parse_coordinate(value.value_or(String {})); } else if (name == SVG::AttributeNames::href || name == "xlink:href"_fly_string) { - m_referenced_id = parse_id_from_href(value.value_or(String {})); - - clone_element_tree_as_our_shadow_tree(referenced_element()); + // When the ‘href’ attribute is set (or, in the absence of an ‘href’ attribute, an ‘xlink:href’ attribute), the user agent must process the URL. + process_the_url(value); } } +// https://www.w3.org/TR/SVG2/linking.html#processingURL +void SVGUseElement::process_the_url(Optional const& href) +{ + m_referenced_id = parse_id_from_href(href.value_or(String {})); + + clone_element_tree_as_our_shadow_tree(referenced_element()); +} + Optional SVGUseElement::parse_id_from_href(StringView href) { auto id_seperator = href.find('#'); diff --git a/Userland/Libraries/LibWeb/SVG/SVGUseElement.h b/Userland/Libraries/LibWeb/SVG/SVGUseElement.h index 11df4d32772..8a332f449cd 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGUseElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGUseElement.h @@ -51,6 +51,8 @@ private: virtual JS::GCPtr create_layout_node(NonnullRefPtr) override; + void process_the_url(Optional const& href); + static Optional parse_id_from_href(StringView); JS::GCPtr referenced_element();