Skip to content

Commit 88d1287

Browse files
committed
remove animation before measuring
1 parent 38cc2a6 commit 88d1287

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/svelte/src/internal/client/dom/elements/transitions.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,20 @@ export function animation(element, get_fn, get_params) {
9494
from = this.element.getBoundingClientRect();
9595
},
9696
apply() {
97+
animation?.abort();
98+
9799
to = this.element.getBoundingClientRect();
98100

99101
const options = get_fn()(this.element, { from, to }, get_params?.());
100102

101-
animation?.abort();
102-
103103
if (
104104
from.left !== to.left ||
105105
from.right !== to.right ||
106106
from.top !== to.top ||
107107
from.bottom !== to.bottom
108108
) {
109109
animation = animate(this.element, options, undefined, 1, () => {
110+
animation?.abort();
110111
animation = undefined;
111112
});
112113
}

0 commit comments

Comments
 (0)