Skip to content

Commit 5adf8a6

Browse files
committed
Merge branch 'master' of github.com:marcj/css-element-queries
2 parents f6144fb + da5f446 commit 5adf8a6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ElementQueries.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,11 @@
409409

410410
document.body.addEventListener(animationStart, function (e) {
411411
var element = e.target;
412-
var styles = window.getComputedStyle(element, null);
412+
var styles = element && window.getComputedStyle(element, null);
413+
var animationName = styles && styles.getPropertyValue('animation-name');
414+
var requiresSetup = animationName && (-1 !== animationName.indexOf('element-queries'));
413415

414-
if (-1 !== styles.getPropertyValue('animation-name').indexOf('element-queries')) {
416+
if (requiresSetup) {
415417
element.elementQueriesSensor = new ResizeSensor(element, function () {
416418
if (element.elementQueriesSetupInformation) {
417419
element.elementQueriesSetupInformation.call();

0 commit comments

Comments
 (0)