title: Can I detect if an arbitrary CSS transition has started
body: <p>In my close function I want to do all my DOM clean-up stuff after css transitions have finished running. But there might not be any transitions running/might be multi-stage ones - (maintaining the stylesheets is out of my hands).</p>
  
  <p>How would I go about writing a function something like the following</p>
  
  <pre><code>function close () {
    myEl.removeClass('open');
    if (animation is running/about to be run) {
      // wait for transition to end, then recursively check to see if another 
      // one has started, wait for that ...
      // then
      cleanUpDOM(); 
    } else {
      cleanUpDOM(); 
    }
  }
  </code></pre>
  
  <p>My thoughts so far are to wrap the initial check in a timeout/requestAnimationFrame in order to give the animation a chance to start then checking to see if it's running. Unfortunately, without a <code>transitionstart</code> event I have no idea how to check if a transition has begun.</p>
  
  <p><em>edit</em> Answers recommending jquery are irrelevant as jquery animations are javascript animations, not CSS transitions</p>