fix: #4233 `bind:offsetHeight` doesn't always fire

pull/8096/head
Jos de Jong 4 years ago
parent aa5a1cdf1a
commit 9a9db1c70f

@ -624,6 +624,10 @@ export function add_resize_listener(node: HTMLElement, fn: () => void) {
iframe.src = 'about:blank';
iframe.onload = () => {
unsubscribe = listen(iframe.contentWindow, 'resize', fn);
// make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)
// see https://github.com/sveltejs/svelte/issues/4233
fn();
};
}

Loading…
Cancel
Save