gecko/layout/reftests/svg/smil/container/deferred-anim-1.xhtml

49 lines
1.8 KiB
HTML

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait">
<head>
<title>Deferred animation</title>
<!--
PURPOSE: Although we'd like to disable animation components for those
documents that don't use animation, there's always the possibility that an
animation element will be added via the DOM after the document is loaded.
This test case checks that this case is not neglected.
OPERATION: There is an un-animated document. Then an <animate> element is
attached to the rectangle by script causing it to move to the right.
EXPECTED RESULTS: The box begins moving from the center.
-->
<script>
function animate()
{
var svg = document.getElementsByTagName('svg')[0];
addAnimation();
setTimeout('document.documentElement.removeAttribute("class")', 150);
}
function addAnimation()
{
const svgns="http://www.w3.org/2000/svg";
var anim = document.createElementNS(svgns,'animate');
anim.setAttribute('attributeName','x');
anim.setAttribute('from','0');
anim.setAttribute('to','90');
anim.setAttribute('begin','0s');
anim.setAttribute('dur','0.01s');
anim.setAttribute('fill','freeze');
var target = document.getElementById('target');
target.appendChild(anim);
}
</script>
</head>
<body onload="animate()">
<svg xmlns="http://www.w3.org/2000/svg" width="200px" height="200px">
<rect x="1" y="1" width="198" height="198"
style="fill: none; stroke: black"/>
<rect x="-20" y="80" width="40" height="40" fill="royalblue"
stroke="black" stroke-width="1" id="target"/>
</svg>
</body>
</html>