<svg>
<filter id="filter">
  <feDiffuseLighting>
    <feSpotLight>
      <animate id="animate" attributeName="limitingConeAngle" from="0" to="1" dur="1s" repeatCount="indefinite">
    </feSpotLight>
  </feDiffuseLighting>
</filter>
<rect id="rect" width="1" height="1" filter="url(#filter)">
</svg>
<script>
if (window.testRunner) {
    testRunner.dumpAsText()
    testRunner.waitUntilDone()
}

window.onload = function() {
    animate = document.getElementById('animate')
    retry = true

    function runTest() {
        if (retry) {  // Wait for at least one animation frame before reparenting.
            lastAnimVal = animate.parentElement.limitingConeAngle.animVal
            if (lastAnimVal > 0) {
                animate.appendChild(document.getElementById('rect'))
                retry = false
            }
        // Wait for at least one more animation frame so we know it succeeded.
        } else if (lastAnimVal != animate.parentElement.limitingConeAngle.animVal) {
            document.body.appendChild(document.createTextNode('PASS - Test succeeded.'))
            if (window.testRunner)
                testRunner.notifyDone()
            return
        }

        setTimeout(runTest, 0)
    }

    runTest()
}
</script>
<p>This test moves an animated filter target. The test will display a message below if successful.</p>
