mirror of https://github.com/sveltejs/svelte
fix: ensure `bind:offsetHeight` updates (#8096)
fixes #4233 by calling the callback after the iframe loads, which may be asynchronous --------- Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>pull/8326/head
parent
709264a94c
commit
e5b0b6235d
@ -0,0 +1,6 @@
|
|||||||
|
export default {
|
||||||
|
async test({ assert, component }) {
|
||||||
|
assert.equal(component.toggle, true);
|
||||||
|
assert.equal(component.offsetHeight, 800);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,18 @@
|
|||||||
|
<script>
|
||||||
|
export let offsetHeight;
|
||||||
|
export let offsetWidth;
|
||||||
|
export let toggle = false;
|
||||||
|
$: if (offsetWidth) {
|
||||||
|
toggle = true;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class:toggle>
|
||||||
|
<div bind:offsetHeight bind:offsetWidth>{offsetHeight}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.toggle > div {
|
||||||
|
height: 800px;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in new issue