@@ -1434,7 +1434,8 @@ function cloneVNodes (vnodes) {
1434
1434
1435
1435
function normalizeChildren (
1436
1436
children ,
1437
- ns
1437
+ ns ,
1438
+ nestedIndex
1438
1439
) {
1439
1440
if ( isPrimitive ( children ) ) {
1440
1441
return [ createTextVNode ( children ) ]
@@ -1446,7 +1447,7 @@ function normalizeChildren (
1446
1447
var last = res [ res . length - 1 ]
1447
1448
// nested
1448
1449
if ( Array . isArray ( c ) ) {
1449
- res . push . apply ( res , normalizeChildren ( c , ns ) )
1450
+ res . push . apply ( res , normalizeChildren ( c , ns , i ) )
1450
1451
} else if ( isPrimitive ( c ) ) {
1451
1452
if ( last && last . text ) {
1452
1453
last . text += String ( c )
@@ -1462,6 +1463,10 @@ function normalizeChildren (
1462
1463
if ( ns ) {
1463
1464
applyNS ( c , ns )
1464
1465
}
1466
+ // default key for nested array children (likely generated by v-for)
1467
+ if ( c . key == null && nestedIndex != null ) {
1468
+ c . key = "__vlist_" + nestedIndex + "_" + i + "__"
1469
+ }
1465
1470
res . push ( c )
1466
1471
}
1467
1472
}
@@ -1533,13 +1538,15 @@ function updateListeners (
1533
1538
}
1534
1539
add ( event , cur . invoker , capture )
1535
1540
}
1536
- } else if ( Array . isArray ( old ) ) {
1537
- old . length = cur . length
1538
- for ( var i = 0 ; i < old . length ; i ++ ) old [ i ] = cur [ i ]
1539
- on [ name ] = old
1540
- } else {
1541
- old . fn = cur
1542
- on [ name ] = old
1541
+ } else if ( cur !== old ) {
1542
+ if ( Array . isArray ( old ) ) {
1543
+ old . length = cur . length
1544
+ for ( var i = 0 ; i < old . length ; i ++ ) old [ i ] = cur [ i ]
1545
+ on [ name ] = old
1546
+ } else {
1547
+ old . fn = cur
1548
+ on [ name ] = old
1549
+ }
1543
1550
}
1544
1551
}
1545
1552
for ( name in oldOn ) {
@@ -2142,13 +2149,6 @@ function renderMixin (Vue) {
2142
2149
var staticRenderFns = ref . staticRenderFns ;
2143
2150
var _parentVnode = ref . _parentVnode ;
2144
2151
2145
- if ( vm . _isMounted ) {
2146
- // clone slot nodes on re-renders
2147
- for ( var key in vm . $slots ) {
2148
- vm . $slots [ key ] = cloneVNodes ( vm . $slots [ key ] )
2149
- }
2150
- }
2151
-
2152
2152
if ( staticRenderFns && ! vm . _staticTrees ) {
2153
2153
vm . _staticTrees = [ ]
2154
2154
}
@@ -2261,6 +2261,30 @@ function renderMixin (Vue) {
2261
2261
return ret
2262
2262
}
2263
2263
2264
+ // renderSlot
2265
+ Vue . prototype . _t = function (
2266
+ name ,
2267
+ fallback
2268
+ ) {
2269
+ var slotNodes = this . $slots [ name ]
2270
+ if ( slotNodes ) {
2271
+ // warn duplicate slot usage
2272
+ if ( process . env . NODE_ENV !== 'production' ) {
2273
+ slotNodes . _rendered && warn (
2274
+ "Duplicate presense of slot \"" + name + "\" found in the same render tree " +
2275
+ "- this will likely cause render errors." ,
2276
+ this
2277
+ )
2278
+ slotNodes . _rendered = true
2279
+ }
2280
+ // clone slot nodes on re-renders
2281
+ if ( this . _isMounted ) {
2282
+ slotNodes = cloneVNodes ( slotNodes )
2283
+ }
2284
+ }
2285
+ return slotNodes || fallback
2286
+ }
2287
+
2264
2288
// apply v-bind object
2265
2289
Vue . prototype . _b = function bindProps (
2266
2290
vnode ,
@@ -3261,7 +3285,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
3261
3285
get : function ( ) { return config . _isServer ; }
3262
3286
} )
3263
3287
3264
- Vue . version = '2.0.0-rc.4 '
3288
+ Vue . version = '2.0.0-rc.5 '
3265
3289
3266
3290
/* */
3267
3291
@@ -3704,7 +3728,7 @@ function createPatchFunction (backend) {
3704
3728
}
3705
3729
3706
3730
function createElm ( vnode , insertedVnodeQueue , nested ) {
3707
- var i , elm
3731
+ var i
3708
3732
var data = vnode . data
3709
3733
vnode . isRootInsert = ! nested
3710
3734
if ( isDef ( data ) ) {
@@ -3735,28 +3759,32 @@ function createPatchFunction (backend) {
3735
3759
)
3736
3760
}
3737
3761
}
3738
- elm = vnode . elm = vnode . ns
3762
+ vnode . elm = vnode . ns
3739
3763
? nodeOps . createElementNS ( vnode . ns , tag )
3740
3764
: nodeOps . createElement ( tag )
3741
3765
setScope ( vnode )
3742
- if ( Array . isArray ( children ) ) {
3743
- for ( i = 0 ; i < children . length ; ++ i ) {
3744
- nodeOps . appendChild ( elm , createElm ( children [ i ] , insertedVnodeQueue , true ) )
3745
- }
3746
- } else if ( isPrimitive ( vnode . text ) ) {
3747
- nodeOps . appendChild ( elm , nodeOps . createTextNode ( vnode . text ) )
3748
- }
3766
+ createChildren ( vnode , children , insertedVnodeQueue )
3749
3767
if ( isDef ( data ) ) {
3750
3768
invokeCreateHooks ( vnode , insertedVnodeQueue )
3751
3769
}
3752
3770
} else if ( vnode . isComment ) {
3753
- elm = vnode . elm = nodeOps . createComment ( vnode . text )
3771
+ vnode . elm = nodeOps . createComment ( vnode . text )
3754
3772
} else {
3755
- elm = vnode . elm = nodeOps . createTextNode ( vnode . text )
3773
+ vnode . elm = nodeOps . createTextNode ( vnode . text )
3756
3774
}
3757
3775
return vnode . elm
3758
3776
}
3759
3777
3778
+ function createChildren ( vnode , children , insertedVnodeQueue ) {
3779
+ if ( Array . isArray ( children ) ) {
3780
+ for ( var i = 0 ; i < children . length ; ++ i ) {
3781
+ nodeOps . appendChild ( vnode . elm , createElm ( children [ i ] , insertedVnodeQueue , true ) )
3782
+ }
3783
+ } else if ( isPrimitive ( vnode . text ) ) {
3784
+ nodeOps . appendChild ( vnode . elm , nodeOps . createTextNode ( vnode . text ) )
3785
+ }
3786
+ }
3787
+
3760
3788
function isPatchable ( vnode ) {
3761
3789
while ( vnode . child ) {
3762
3790
vnode = vnode . child . _vnode
@@ -3954,7 +3982,7 @@ function createPatchFunction (backend) {
3954
3982
// reuse element for static trees.
3955
3983
// note we only do this if the vnode is cloned -
3956
3984
// if the new node is not cloned it means the render functions have been
3957
- // reset by the hot-reload-api and we need to a proper re-render.
3985
+ // reset by the hot-reload-api and we need to do a proper re-render.
3958
3986
if ( vnode . isStatic &&
3959
3987
oldVnode . isStatic &&
3960
3988
vnode . key === oldVnode . key &&
@@ -4028,26 +4056,31 @@ function createPatchFunction (backend) {
4028
4056
if ( isDef ( tag ) ) {
4029
4057
if ( isDef ( children ) ) {
4030
4058
var childNodes = nodeOps . childNodes ( elm )
4031
- var childrenMatch = true
4032
- if ( childNodes . length !== children . length ) {
4033
- childrenMatch = false
4059
+ // empty element, allow client to pick up and populate children
4060
+ if ( ! childNodes . length ) {
4061
+ createChildren ( vnode , children , insertedVnodeQueue )
4034
4062
} else {
4035
- for ( var i$1 = 0 ; i$1 < children . length ; i$1 ++ ) {
4036
- if ( ! hydrate ( childNodes [ i$1 ] , children [ i$1 ] , insertedVnodeQueue ) ) {
4037
- childrenMatch = false
4038
- break
4063
+ var childrenMatch = true
4064
+ if ( childNodes . length !== children . length ) {
4065
+ childrenMatch = false
4066
+ } else {
4067
+ for ( var i$1 = 0 ; i$1 < children . length ; i$1 ++ ) {
4068
+ if ( ! hydrate ( childNodes [ i$1 ] , children [ i$1 ] , insertedVnodeQueue ) ) {
4069
+ childrenMatch = false
4070
+ break
4071
+ }
4039
4072
}
4040
4073
}
4041
- }
4042
- if ( ! childrenMatch ) {
4043
- if ( process . env . NODE_ENV !== 'production' &&
4044
- typeof console !== 'undefined' &&
4045
- ! bailed ) {
4046
- bailed = true
4047
- console . warn ( 'Parent: ' , elm )
4048
- console . warn ( 'Mismatching childNodes vs. VNodes: ' , childNodes , children )
4074
+ if ( ! childrenMatch ) {
4075
+ if ( process . env . NODE_ENV !== 'production' &&
4076
+ typeof console !== 'undefined' &&
4077
+ ! bailed ) {
4078
+ bailed = true
4079
+ console . warn ( 'Parent: ' , elm )
4080
+ console . warn ( 'Mismatching childNodes vs. VNodes: ' , childNodes , children )
4081
+ }
4082
+ return false
4049
4083
}
4050
- return false
4051
4084
}
4052
4085
}
4053
4086
if ( isDef ( data ) ) {
@@ -4142,9 +4175,18 @@ function createPatchFunction (backend) {
4142
4175
4143
4176
var directives = {
4144
4177
create : function bindDirectives ( oldVnode , vnode ) {
4145
- mergeVNodeHook ( vnode . data . hook || ( vnode . data . hook = { } ) , 'insert' , function ( ) {
4146
- applyDirectives ( oldVnode , vnode , 'bind' )
4178
+ var hasInsert = false
4179
+ forEachDirective ( oldVnode , vnode , function ( def , dir ) {
4180
+ callHook$1 ( def , dir , 'bind' , vnode , oldVnode )
4181
+ if ( def . inserted ) {
4182
+ hasInsert = true
4183
+ }
4147
4184
} )
4185
+ if ( hasInsert ) {
4186
+ mergeVNodeHook ( vnode . data . hook || ( vnode . data . hook = { } ) , 'insert' , function ( ) {
4187
+ applyDirectives ( oldVnode , vnode , 'inserted' )
4188
+ } )
4189
+ }
4148
4190
} ,
4149
4191
update : function updateDirectives ( oldVnode , vnode ) {
4150
4192
applyDirectives ( oldVnode , vnode , 'update' )
@@ -4164,32 +4206,47 @@ var directives = {
4164
4206
4165
4207
var emptyModifiers = Object . create ( null )
4166
4208
4167
- function applyDirectives (
4209
+ function forEachDirective (
4168
4210
oldVnode ,
4169
4211
vnode ,
4170
- hook
4212
+ fn
4171
4213
) {
4172
4214
var dirs = vnode . data . directives
4173
4215
if ( dirs ) {
4174
- var oldDirs = oldVnode . data . directives
4175
- var isUpdate = hook === 'update' || hook === 'componentUpdated'
4176
4216
for ( var i = 0 ; i < dirs . length ; i ++ ) {
4177
4217
var dir = dirs [ i ]
4178
4218
var def = resolveAsset ( vnode . context . $options , 'directives' , dir . name , true )
4179
- var fn = def && def [ hook ]
4180
- if ( fn ) {
4181
- if ( isUpdate && oldDirs ) {
4219
+ if ( def ) {
4220
+ var oldDirs = oldVnode && oldVnode . data . directives
4221
+ if ( oldDirs ) {
4182
4222
dir . oldValue = oldDirs [ i ] . value
4183
4223
}
4184
4224
if ( ! dir . modifiers ) {
4185
4225
dir . modifiers = emptyModifiers
4186
4226
}
4187
- fn ( vnode . elm , dir , vnode , oldVnode )
4227
+ fn ( def , dir )
4188
4228
}
4189
4229
}
4190
4230
}
4191
4231
}
4192
4232
4233
+ function applyDirectives (
4234
+ oldVnode ,
4235
+ vnode ,
4236
+ hook
4237
+ ) {
4238
+ forEachDirective ( oldVnode , vnode , function ( def , dir ) {
4239
+ callHook$1 ( def , dir , hook , vnode , oldVnode )
4240
+ } )
4241
+ }
4242
+
4243
+ function callHook$1 ( def , dir , hook , vnode , oldVnode ) {
4244
+ var fn = def && def [ hook ]
4245
+ if ( fn ) {
4246
+ fn ( vnode . elm , dir , vnode , oldVnode )
4247
+ }
4248
+ }
4249
+
4193
4250
var baseModules = [
4194
4251
ref ,
4195
4252
directives
@@ -5019,7 +5076,7 @@ var show = {
5019
5076
5020
5077
vnode = locateNode ( vnode )
5021
5078
var transition = vnode . data && vnode . data . transition
5022
- if ( value && transition && transition . appear && ! isIE9 ) {
5079
+ if ( value && transition && ! isIE9 ) {
5023
5080
enter ( vnode )
5024
5081
}
5025
5082
var originalDisplay = el . style . display === 'none' ? '' : el . style . display
@@ -5249,7 +5306,7 @@ var TransitionGroup = {
5249
5306
for ( var i = 0 ; i < rawChildren . length ; i ++ ) {
5250
5307
var c = rawChildren [ i ]
5251
5308
if ( c . tag ) {
5252
- if ( c . key != null ) {
5309
+ if ( c . key != null && String ( c . key ) . indexOf ( '__vlist' ) !== 0 ) {
5253
5310
children . push ( c )
5254
5311
map [ c . key ] = c
5255
5312
; ( c . data || ( c . data = { } ) ) . transition = transitionData
0 commit comments