Skip to content

Commit f10d402

Browse files
Fix animation error on chrome <=46
web-animations#72
1 parent b5d9141 commit f10d402

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/web-animations-bonus-object-form-keyframes.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@
1616
// If an animation with the new syntax applies an effect, there's no need
1717
// to load this part of the polyfill.
1818
var element = document.documentElement;
19-
var animation = element.animate({'opacity': ['1', '0']},
20-
{duration: 1, fill: 'forwards'});
21-
animation.finish();
22-
var animated = getComputedStyle(element).getPropertyValue('opacity') == '0';
23-
animation.cancel();
19+
var animated = true;
20+
try {
21+
var animation = element.animate({'opacity': ['1', '0']},
22+
{duration: 1, fill: 'forwards'});
23+
animation.finish();
24+
animated = getComputedStyle(element).getPropertyValue('opacity') == '0';
25+
animation.cancel();
26+
} catch (err) {
27+
animated = false;
28+
}
2429
if (animated) {
2530
return;
2631
}

0 commit comments

Comments
 (0)