@@ -233,7 +233,7 @@ module.exports = {
233233 var ctn = this . container ,
234234 vms = this . vms ,
235235 col = this . collection ,
236- el , i , ref , item , primitive , noInsert
236+ el , i , ref , item , primitive , detached
237237
238238 // append node into DOM first
239239 // so v-if can get access to parentNode
@@ -253,7 +253,7 @@ module.exports = {
253253 data . $index = index
254254 // existing VM's el can possibly be detached by v-if.
255255 // in that case don't insert.
256- noInsert = ! el . parentNode
256+ detached = ! el . parentNode
257257
258258 } else { // new data, need to create new VM
259259
@@ -275,11 +275,15 @@ module.exports = {
275275 : this . ref
276276 // make sure it works with v-if
277277 if ( ! ref . parentNode ) ref = ref . vue_ref
278- // insert node with transition
279- if ( ! noInsert ) {
278+ if ( ! detached ) {
279+ // insert node with transition
280280 transition ( el , 1 , function ( ) {
281281 ctn . insertBefore ( el , ref )
282282 } , this . compiler )
283+ } else {
284+ // detached by v-if
285+ // just move the comment ref node
286+ ctn . insertBefore ( el . vue_ref , ref )
283287 }
284288 }
285289
0 commit comments