--- title: targetElement slug: Web/API/SVGAnimationElement/targetElement translation_of: Web/API/SVGAnimationElement/targetElement ---
{{APIRef("SVG")}}

SVGAnimationElement.targetElement属性是指完成动画的元素。如果没有目标元素在执行动画(例如:因为 {{SVGAttr("href")}}属性指定了一个未知的元素 ),这个值将返回null

语法

var targetElement = someElement.targetElement;

技术规范

技术规范 状态 注释
{{SpecName("SVG Animations 2", "#__svg__SVGAnimationElement__targetElement", "SVGAnimationElement.targetElement")}} {{Spec2("SVG Animations 2")}}

添加null作为没有目标元素执行动画时的返回值。

{{SpecName("SVG1.1", "animate.html#__svg__SVGAnimationElement__targetElement", "SVGAnimationElement.targetElement")}} {{Spec2("SVG1.1")}} 初始定义

浏览器兼容性

{{Compat("api.SVGAnimationElement.targetElement")}}