Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!doctype html>
<title>SVGPathElement.getPathData() returns base value during Web Animations</title>
<link rel="author" title="Virali Purbey" href="mailto:viralipurbey@microsoft.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/getPathData-helpers.js"></script>
<svg>
<path id="path" d="M 0 0 L 10 10"/>
</svg>
<script>
test(() => {
// Animate the CSS `d` property via Web Animations. getPathData() must
// still return the attribute base value, not the animated/interpolated
// value (matches getAttribute("d") semantics).
const anim = path.animate(
[{ d: 'path("M 100 100 L 200 200")' },
{ d: 'path("M 300 300 L 400 400")' }],
{ duration: 1000, fill: 'forwards' });
anim.pause();
anim.currentTime = 500;
assert_not_equals(getComputedStyle(path).getPropertyValue("d"),
"none", "CSS 'd' animation is applied");
assert_path_data_equals(path.getPathData(), [
{ type: "M", values: [0, 0] },
{ type: "L", values: [10, 10] }
]);
}, "path.getPathData() returns attribute base value during Web Animations");
</script>