title: webkitAnimationEnd fires at the start
body: <p>I'm trying to animate a scrolling ticker that moves text horizontally across the screen.</p>
  
  <p>The webkitAnimationEnd event appears to fire as soon as the page is loaded, rather than when the animation has finished. Why is this happening?</p>
  
  <p>When I look at other examples using the same approach, the event seems to fire correctly when viewed using this same browser - so it must be a problem with my code. I'd like to detect the "end" event so I can update the text in the div element before rescrolling the ticker.)</p>
  
  <p>Here's my code (also in a jsFiddle, <a href="https://jsfiddle.net/yt0brojh/7/" rel="nofollow noreferrer">here</a>):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var tt;
  
  function startTicker() {
    tt = document.getElementById("tickerText");
    tt.addEventListener('webkitAnimationEnd', updateTicker());
  }
  
  function updateTicker() {
    alert('end');
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
    color: #829CB5;
    background-color: #1A354A;
    font-size: 60%;
    font-family: sans-serif;
    overflow: hidden
  }
  
  div#ticker {
    font-size: 140%;
    position: absolute;
    top: 0;
    left: -2px;
    border-width: 2px;
    height: 1em;
    width: 101%;
    background-color: black;
    color: #CEEAFA;
  }
  
  div#tickerText {
    position: absolute;
    top: 2px;
    left: 0px;
    height: 1em;
    width: 101%;
    background-color: black;
    color: #CEEAFA;
    -webkit-transform: translateX(100%);
    -webkit-animation-duration: 30s;
    -webkit-animation-timing-function: linear;
    -webkit-animation-iteration-count: 2;
    -webkit-animation-name: scrollTicker;
  }
  
  @-webkit-keyframes scrollTicker {
    0% {
      -webkit-transform: translateX(100%);
    }
    100% {
      -webkit-transform: translateX(-100%);
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  
  &lt;head&gt;
  
  &lt;/head&gt;
  
  &lt;body onload="startTicker()"&gt;
  
    &lt;div id="ticker"&gt;
      &lt;div id="tickerText"&gt;Test&lt;/div&gt;
    &lt;/div&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I'd like to use just CSS and Javascript (rather than libraries like Jquery).</p>