Skip to content

Commit

Permalink
fix: sveltejs#4233 bind:offsetHeight doesn't always fire
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Dec 8, 2022
1 parent aa5a1cd commit 9a9db1c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime/internal/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
}

Expand Down

0 comments on commit 9a9db1c

Please sign in to comment.