From 5f466508019983f44a58a47ea394be8fcd3ce5c7 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 30 Apr 2018 21:03:34 -0400 Subject: [PATCH] update test --- test/js/samples/bind-width-height/expected-bundle.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/js/samples/bind-width-height/expected-bundle.js b/test/js/samples/bind-width-height/expected-bundle.js index 4d003e7e85..0787252e8d 100644 --- a/test/js/samples/bind-width-height/expected-bundle.js +++ b/test/js/samples/bind-width-height/expected-bundle.js @@ -26,8 +26,11 @@ function addResizeListener(element, fn) { object.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;'); object.type = 'text/html'; + let win; + object.onload = () => { - object.contentDocument.defaultView.addEventListener('resize', fn); + win = object.contentDocument.defaultView; + win.addEventListener('resize', fn); }; if (/Trident/.test(navigator.userAgent)) { @@ -40,7 +43,7 @@ function addResizeListener(element, fn) { return { cancel: () => { - object.contentDocument.defaultView.removeEventListener('resize', fn); + win.removeEventListener('resize', fn); element.removeChild(object); } };