8000 transition: handle just-entered edge case · justnull/vue@c7cfd59 · GitHub
[go: up one dir, main page]

Skip to content

Commit c7cfd59

Browse files
committed
transition: handle just-entered edge case
1 parent 13e0335 commit c7cfd59

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/transition/transition.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,20 @@ p.enter = function (op, cb) {
9494
*/
9595

9696
p.enterNextTick = function () {
97+
98+
// Importnatn hack:
99+
// in Chrome, if a just-entered element is applied the
100+
// leave class while its interpolated property still has
101+
// a very small value (within one frame), Chrome will
102+
// skip the leave transition entirely and not firing the
103+
// transtionend event. Therefore we need to protected
104+
// against such cases using a one-frame timeout.
97105
this.justEntered = true
98-
_.nextTick(function () {
99-
this.justEntered = false
100-
}, this)
106+
var self = this
107+
setTimeout(function () {
108+
self.justEntered = false
109+
}, 17)
110+
101111
var enterDone = this.enterDone
102112
var type = this.getCssTransitionType(this.enterClass)
103113
if (!this.pendingJsCb) {

0 commit comments

Comments
 (0)

Footer

© 2025 GitHub, Inc.
0