diff --git a/Tests/LibWeb/Text/expected/SVG/svg-href.txt b/Tests/LibWeb/Text/expected/SVG/svg-href.txt new file mode 100644 index 0000000000..cadbb42427 --- /dev/null +++ b/Tests/LibWeb/Text/expected/SVG/svg-href.txt @@ -0,0 +1,114 @@ + --------------- +use - no-xlink-href +--------------- +element.href instanceof SVGAnimatedString -> true +element.href === element.href -> true +element.href.baseVal -> +element.href.animVal -> +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> null +element.getAttribute("href") -> null +setting baseVal... +done, new values: +element.href.baseVal -> testSet +element.href.animVal -> testSet +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> null +element.getAttribute("href") -> testSet +animVal should be readonly: +TypeError: Cannot set property 'animVal' of [object SVGAnimatedString] +--------------- +use - explicit-xlink-href +--------------- +element.href instanceof SVGAnimatedString -> true +element.href === element.href -> true +element.href.baseVal -> test1 +element.href.animVal -> test1 +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> test1 +element.getAttribute("href") -> null +setting baseVal... +done, new values: +element.href.baseVal -> testSet +element.href.animVal -> testSet +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> testSet +element.getAttribute("href") -> null +animVal should be readonly: +TypeError: Cannot set property 'animVal' of [object SVGAnimatedString] +--------------- +use - implicit-xlink-href +--------------- +element.href instanceof SVGAnimatedString -> true +element.href === element.href -> true +element.href.baseVal -> test2 +element.href.animVal -> test2 +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> null +element.getAttribute("href") -> test2 +setting baseVal... +done, new values: +element.href.baseVal -> testSet +element.href.animVal -> testSet +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> null +element.getAttribute("href") -> testSet +animVal should be readonly: +TypeError: Cannot set property 'animVal' of [object SVGAnimatedString] +--------------- +textPath - no-xlink-href +--------------- +element.href instanceof SVGAnimatedString -> true +element.href === element.href -> true +element.href.baseVal -> +element.href.animVal -> +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> null +element.getAttribute("href") -> null +setting baseVal... +done, new values: +element.href.baseVal -> testSet +element.href.animVal -> testSet +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> null +element.getAttribute("href") -> testSet +animVal should be readonly: +TypeError: Cannot set property 'animVal' of [object SVGAnimatedString] +--------------- +textPath - explicit-xlink-href +--------------- +element.href instanceof SVGAnimatedString -> true +element.href === element.href -> true +element.href.baseVal -> test1 +element.href.animVal -> test1 +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> test1 +element.getAttribute("href") -> null +setting baseVal... +done, new values: +element.href.baseVal -> testSet +element.href.animVal -> testSet +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> testSet +element.getAttribute("href") -> null +animVal should be readonly: +TypeError: Cannot set property 'animVal' of [object SVGAnimatedString] +--------------- +textPath - implicit-xlink-href +--------------- +element.href instanceof SVGAnimatedString -> true +element.href === element.href -> true +element.href.baseVal -> test2 +element.href.animVal -> test2 +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> null +element.getAttribute("href") -> test2 +setting baseVal... +done, new values: +element.href.baseVal -> testSet +element.href.animVal -> testSet +element.href.baseVal === element.href.animVal -> true +element.getAttribute("xlink:href") -> null +element.getAttribute("href") -> testSet +animVal should be readonly: +TypeError: Cannot set property 'animVal' of [object SVGAnimatedString] \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/SVG/svg-href.html b/Tests/LibWeb/Text/input/SVG/svg-href.html new file mode 100644 index 0000000000..d957bf6a98 --- /dev/null +++ b/Tests/LibWeb/Text/input/SVG/svg-href.html @@ -0,0 +1,57 @@ + + + + + + + + + + + + diff --git a/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp index c14ae56d31..72f0aff047 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp @@ -44,6 +44,7 @@ void SVGUseElement::initialize(JS::Realm& realm) void SVGUseElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); + SVGURIReferenceMixin::visit_edges(visitor); visitor.visit(m_document_observer); } diff --git a/Userland/Libraries/LibWeb/SVG/SVGUseElement.h b/Userland/Libraries/LibWeb/SVG/SVGUseElement.h index e7121b5fde..60371f0746 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGUseElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGUseElement.h @@ -11,10 +11,13 @@ #include #include #include +#include namespace Web::SVG { -class SVGUseElement final : public SVGGraphicsElement { +class SVGUseElement final + : public SVGGraphicsElement + , public SVGURIReferenceMixin { WEB_PLATFORM_OBJECT(SVGUseElement, SVGGraphicsElement); JS_DECLARE_ALLOCATOR(SVGUseElement); diff --git a/Userland/Libraries/LibWeb/SVG/SVGUseElement.idl b/Userland/Libraries/LibWeb/SVG/SVGUseElement.idl index 37de82fefd..d6a96ff02e 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGUseElement.idl +++ b/Userland/Libraries/LibWeb/SVG/SVGUseElement.idl @@ -1,6 +1,7 @@ #import #import #import +#import // https://svgwg.org/svg2-draft/struct.html#InterfaceSVGUseElement [Exposed=Window] @@ -13,4 +14,4 @@ interface SVGUseElement : SVGGraphicsElement { [SameObject] readonly attribute SVGElement? animatedInstanceRoot; }; -// FIXME: SVGUseElement includes SVGURIReference; +SVGUseElement includes SVGURIReference;