Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /svg/animations/syncbase-remove-add-while-running.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>Remove/Add syncbase while animation is running</title>
<link rel="author" title="Edvard Thörnros" href="mailto:edvardt@opera.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<svg>
<animate id="anim" attributeName="visibility" to="visible" begin="10s" dur="2s"/>
<rect x="0" y="0" width="0" height="100" fill="#0F0">
<set attributeName="width" fill="freeze" to="100" begin="anim.begin"/>
</rect>
</svg>
<script>
async_test(function(t) {
window.onload = t.step_func(function() {
let svg = document.querySelector("svg");
let rect = document.querySelector("rect");
window.requestAnimationFrame(t.step_func(function() {
window.requestAnimationFrame(t.step_func(function() {
var anim1 = document.getElementById("anim");
anim1.parentNode.removeChild(anim1);
anim2.setAttribute("id", "anim");
anim2.setAttribute("attributeName", "visibility");
anim2.setAttribute("to", "visible");
anim2.setAttribute("begin", "0s");
anim2.setAttribute("dur", "2s");
svg.appendChild(anim2);
window.requestAnimationFrame(t.step_func(function() {
window.requestAnimationFrame(t.step_func_done(function() {
svg.pauseAnimations();
assert_equals(rect.width.animVal.value, 100, "Sync base triggered");
}));
}));
}));
}));
});
});
</script>