code: function ensureTransitionEndEvent(el, opt_timeOut) {
    if (opt_timeOut === undefined) {
      var style = getComputedStyle(el);
      opt_timeOut = parseFloat(style.transitionDuration) * 1000;
  
      // Give an additional 50ms buffer for the animation to complete.
      opt_timeOut += 50;
    }
  
    var fired = false;
    el.addEventListener('webkitTransitionEnd', function f(e) {
      el.removeEventListener('webkitTransitionEnd', f);
      fired = true;
    });
    window.setTimeout(function() {
      if (!fired)
        cr.dispatchSimpleEvent(el, 'webkitTransitionEnd', true);
    }, opt_timeOut);
  }
docs: webkitTransitionEnd does not always fire (e.g. when animation is aborted
  or when no paint happens during the animation). This function sets up
  a timer and emulate the event if it is not fired when the timer expires.
  @param {!HTMLElement} el The element to watch for webkitTransitionEnd.
  @param {number=} opt_timeOut The maximum wait time in milliseconds for the
  webkitTransitionEnd to happen. If not specified, it is fetched from |el|
  using the transitionDuration style value.