2017-11-22 12:06:49 +08:00
|
|
|
let animation: boolean;
|
2016-05-26 12:52:07 +08:00
|
|
|
|
|
|
|
function isCssAnimationSupported() {
|
|
|
|
if (animation !== undefined) {
|
|
|
|
return animation;
|
|
|
|
}
|
|
|
|
const domPrefixes = 'Webkit Moz O ms Khtml'.split(' ');
|
|
|
|
const elm = document.createElement('div');
|
|
|
|
if (elm.style.animationName !== undefined) {
|
|
|
|
animation = true;
|
|
|
|
}
|
|
|
|
if (animation !== undefined) {
|
|
|
|
for (let i = 0; i < domPrefixes.length; i++) {
|
2017-11-22 12:06:49 +08:00
|
|
|
if ((elm.style as any)[`${domPrefixes[i]}AnimationName`] !== undefined) {
|
2016-05-26 12:52:07 +08:00
|
|
|
animation = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
animation = animation || false;
|
|
|
|
return animation;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default isCssAnimationSupported;
|