8000 do not attempt to apply v-show leave transition if element is out-of-… · Hsinwe/vue@d6ee905 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6ee905

Browse files
committed
do not attempt to apply v-show leave transition if element is out-of-DOM (fix vuejs#2022)
1 parent bbf5e59 commit d6ee905

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/directives/public/show.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getAttr } from '../../util/index'
1+
import { getAttr, inDoc } from '../../util/index'
22
import { applyTransition } from '../../transition/index'
33

44
export default {
@@ -19,8 +19,13 @@ export default {
1919
},
2020

2121
apply (el, value) {
22-
applyTransition(el, value ? 1 : -1, function () {
22+
if (inDoc(el)) {
23+
applyTransition(el, value ? 1 : -1, toggle, this.vm)
24+
} else {
25+
toggle()
26+
}
27+
function toggle () {
2328
el.style.display = value ? '' : 'none'
24-
}, this.vm)
29+
}
2530
}
2631
}

0 commit comments

Comments
 (0)
0