2015-06-12 13:59:39 +02:00
|
|
|
// XXX Should we use something like Moderniz instead of our custom detector?
|
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
function whichTransitionEvent() {
|
|
|
|
|
const el = document.createElement('fakeelement');
|
|
|
|
|
const transitions = {
|
2015-06-12 13:59:39 +02:00
|
|
|
transition:'transitionend',
|
|
|
|
|
OTransition:'oTransitionEnd',
|
|
|
|
|
MSTransition:'msTransitionEnd',
|
|
|
|
|
MozTransition:'transitionend',
|
2015-09-03 23:12:46 +02:00
|
|
|
WebkitTransition:'webkitTransitionEnd',
|
2015-06-12 13:59:39 +02:00
|
|
|
};
|
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
for (const t in transitions) {
|
2015-06-12 13:59:39 +02:00
|
|
|
if (el.style[t] !== undefined) {
|
|
|
|
|
return transitions[t];
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-02-13 03:12:01 +01:00
|
|
|
return null;
|
2015-09-03 23:12:46 +02:00
|
|
|
}
|
2015-06-12 13:59:39 +02:00
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
function whichAnimationEvent() {
|
|
|
|
|
const el = document.createElement('fakeelement');
|
|
|
|
|
const transitions = {
|
2015-06-12 13:59:39 +02:00
|
|
|
animation:'animationend',
|
|
|
|
|
OAnimation:'oAnimationEnd',
|
|
|
|
|
MSTransition:'msAnimationEnd',
|
|
|
|
|
MozAnimation:'animationend',
|
2015-09-03 23:12:46 +02:00
|
|
|
WebkitAnimation:'webkitAnimationEnd',
|
2015-06-12 13:59:39 +02:00
|
|
|
};
|
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
for (const t in transitions) {
|
2015-06-12 13:59:39 +02:00
|
|
|
if (el.style[t] !== undefined) {
|
|
|
|
|
return transitions[t];
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-02-13 03:12:01 +01:00
|
|
|
return null;
|
2015-09-03 23:12:46 +02:00
|
|
|
}
|
2015-06-12 13:59:39 +02:00
|
|
|
|
|
|
|
|
CSSEvents = {
|
|
|
|
|
transitionend: whichTransitionEvent(),
|
2015-09-03 23:12:46 +02:00
|
|
|
animationend: whichAnimationEvent(),
|
2015-06-12 13:59:39 +02:00
|
|
|
};
|