<!DOCTYPE html>
<title>Timed element not active after first interval active duration changes to unresolved</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<svg>
  <rect width="100" height="100" fill="green">
    <set attributeName="fill" to="red" fill="freeze"
         begin="click" end="click" dur="100ms" repeatCount="indefinite"/>
  </rect>
</svg>
<script>
  async_test(function(t) {
    let set = document.querySelector('set');
    window.onload = t.step_func(function() {
      t.step_timeout(function() {
        set.setAttribute('begin', '-100ms');
        set.setAttribute('begin', 'click');
        set.parentNode.appendChild(set);
        set.setAttribute('end', '-100ms');
        set.setAttribute('end', 'click');
        window.requestAnimationFrame(t.step_func_done(function() {
          let target = set.targetElement;
          assert_equals(getComputedStyle(target).fill, 'rgb(0, 128, 0)');
        }));
      }, 0);
    });
  });
</script>
