Skip to content

Commit 877a996

Browse files
committed
revert
1 parent 73542fa commit 877a996

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

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

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,6 @@ function create_transition(dom, init, direction, effect) {
369369
},
370370
// out
371371
o() {
372-
// @ts-ignore
373-
const has_keyed_transition = dom.__animate;
374-
375372
const needs_reverse = direction === 'both' && curr_direction !== 'out';
376373
curr_direction = 'out';
377374
if (animation === null || cancelled) {
@@ -388,28 +385,6 @@ function create_transition(dom, init, direction, effect) {
388385
/** @type {Animation | TickAnimation} */ (animation).play();
389386
}
390387
}
391-
// If we're outroing an element that has an animation, then we need to fix
392-
// its position to ensure it behaves nicely without causing layout shift.
393-
if (has_keyed_transition) {
394-
const style = getComputedStyle(dom);
395-
const position = style.position;
396-
397-
if (position !== 'absolute' && position !== 'fixed') {
398-
const { width, height } = style;
399-
const a = dom.getBoundingClientRect();
400-
dom.style.position = 'absolute';
401-
dom.style.width = width;
402-
dom.style.height = height;
403-
const b = dom.getBoundingClientRect();
404-
if (a.left !== b.left || a.top !== b.top) {
405-
const style = getComputedStyle(dom);
406-
const transform = style.transform === 'none' ? '' : style.transform;
407-
dom.style.transform = `${transform} translate(${a.left - b.left}px, ${
408-
a.top - b.top
409-
}px)`;
410-
}
411-
}
412-
}
413388
},
414389
// cancel
415390
c() {
@@ -457,16 +432,10 @@ function is_transition_block(block) {
457432
export function bind_transition(dom, get_transition_fn, props_fn, direction, global) {
458433
const transition_effect = /** @type {import('./types.js').EffectSignal} */ (current_effect);
459434
const block = current_block;
460-
const is_keyed_transition = direction === 'key';
461435

462436
let can_show_intro_on_mount = true;
463437
let can_apply_lazy_transitions = false;
464438

465-
if (is_keyed_transition) {
466-
// @ts-ignore
467-
dom.__animate = true;
468-
}
469-
470439
/** @type {import('./types.js').Block | null} */
471440
let transition_block = block;
472441
while (transition_block !== null) {
@@ -510,7 +479,7 @@ export function bind_transition(dom, get_transition_fn, props_fn, direction, glo
510479
const init = (from) =>
511480
untrack(() => {
512481
const props = props_fn === null ? {} : props_fn();
513-
return is_keyed_transition
482+
return direction === 'key'
514483
? /** @type {import('./types.js').AnimateFn<any>} */ (transition_fn)(
515484
dom,
516485
{ from: /** @type {DOMRect} */ (from), to: dom.getBoundingClientRect() },

0 commit comments

Comments
 (0)