all files / addon/utils/ transition.js

8.33% Statements 1/12
0% Branches 0/6
0% Functions 0/1
8.33% Lines 1/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34                                                                  
export default function transition(type) {
  let t;
  let el = document.createElement('fakeelement');
  let transitions = {
    'transition': 'transitionend',
    'OTransition': 'oTransitionEnd',
    'MozTransition': 'transitionend',
    'WebkitTransition': 'webkitTransitionEnd'
  };
 
  let animations = {
    'animation': 'animationend',
    'OAnimation': 'oanimationend',
    'MozAnimation': 'mozAnimationEnd',
    'WebkitAnimation': 'webkitAnimationEnd'
  };
  // this.$().one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'
 
  if (type === 'animation') {
    for (t in animations) {
      if (el.style[t] !== undefined) {
        return animations[t];
      }
    }
  } else {
    for (t in transitions) {
      if (el.style[t] !== undefined) {
        return transitions[t];
      }
    }
  }
}