1
1
/*!
2
- * Vue.js v2.5.2
2
+ * Vue.js v2.5.3
3
3
* (c) 2014-2017 Evan You
4
4
* Released under the MIT License.
5
5
*/
@@ -756,23 +756,29 @@ function createTextVNode (val) {
756
756
// multiple renders, cloning them avoids errors when DOM manipulations rely
757
757
// on their elm reference.
758
758
function cloneVNode ( vnode , deep ) {
759
+ var componentOptions = vnode . componentOptions ;
759
760
var cloned = new VNode (
760
761
vnode . tag ,
761
762
vnode . data ,
762
763
vnode . children ,
763
764
vnode . text ,
764
765
vnode . elm ,
765
766
vnode . context ,
766
- vnode . componentOptions ,
767
+ componentOptions ,
767
768
vnode . asyncFactory
768
769
) ;
769
770
cloned . ns = vnode . ns ;
770
771
cloned . isStatic = vnode . isStatic ;
771
772
cloned . key = vnode . key ;
772
773
cloned . isComment = vnode . isComment ;
773
774
cloned . isCloned = true ;
774
- if ( deep && vnode . children ) {
775
- cloned . children = cloneVNodes ( vnode . children ) ;
775
+ if ( deep ) {
776
+ if ( vnode . children ) {
777
+ cloned . children = cloneVNodes ( vnode . children , true ) ;
778
+ }
779
+ if ( componentOptions && componentOptions . children ) {
780
+ componentOptions . children = cloneVNodes ( componentOptions . children , true ) ;
781
+ }
776
782
}
777
783
return cloned
778
784
}
@@ -1005,7 +1011,7 @@ function set (target, key, val) {
1005
1011
target . splice ( key , 1 , val ) ;
1006
1012
return val
1007
1013
}
1008
- if ( hasOwn ( target , key ) ) {
1014
+ if ( key in target && ! ( key in Object . prototype ) ) {
1009
1015
target [ key ] = val ;
1010
1016
return val
1011
1017
}
@@ -1137,7 +1143,7 @@ function mergeDataOrFn (
1137
1143
typeof parentVal === 'function' ? parentVal . call ( this ) : parentVal
1138
1144
)
1139
1145
}
1140
- } else if ( parentVal || childVal ) {
1146
+ } else {
1141
1147
return function mergedInstanceDataFn ( ) {
1142
1148
// instance merge
1143
1149
var instanceData = typeof childVal === 'function'
@@ -1171,7 +1177,7 @@ strats.data = function (
1171
1177
1172
1178
return parentVal
1173
1179
}
1174
- return mergeDataOrFn . call ( this , parentVal , childVal )
1180
+ return mergeDataOrFn ( parentVal , childVal )
1175
1181
}
1176
1182
1177
1183
return mergeDataOrFn ( parentVal , childVal , vm )
@@ -1977,6 +1983,9 @@ function updateListeners (
1977
1983
/* */
1978
1984
1979
1985
function mergeVNodeHook ( def , hookKey , hook ) {
1986
+ if ( def instanceof VNode ) {
1987
+ def = def . data . hook || ( def . data . hook = { } ) ;
1988
+ }
1980
1989
var invoker ;
1981
1990
var oldHook = def [ hookKey ] ;
1982
1991
@@ -2344,6 +2353,7 @@ function updateComponentListeners (
2344
2353
) {
2345
2354
target = vm ;
2346
2355
updateListeners ( listeners , oldListeners || { } , add , remove$1 , vm ) ;
2356
+ target = undefined ;
2347
2357
}
2348
2358
2349
2359
function eventsMixin ( Vue ) {
@@ -2399,7 +2409,7 @@ function eventsMixin (Vue) {
2399
2409
if ( ! cbs ) {
2400
2410
return vm
2401
2411
}
2402
- if ( arguments . length === 1 ) {
2412
+ if ( ! fn ) {
2403
2413
vm . _events [ event ] = null ;
2404
2414
return vm
2405
2415
}
@@ -2461,7 +2471,6 @@ function resolveSlots (
2461
2471
if ( ! children ) {
2462
2472
return slots
2463
2473
}
2464
- var defaultSlot = [ ] ;
2465
2474
for ( var i = 0 , l = children . length ; i < l ; i ++ ) {
2466
2475
var child = children [ i ] ;
2467
2476
var data = child . data ;
@@ -2482,12 +2491,14 @@ function resolveSlots (
2482
2491
slot . push ( child ) ;
2483
2492
}
2484
2493
} else {
2485
- defaultSlot . push ( child ) ;
2494
+ ( slots . default || ( slots . default = [ ] ) ) . push ( child ) ;
2486
2495
}
2487
2496
}
2488
- // ignore whitespace
2489
- if ( ! defaultSlot . every ( isWhitespace ) ) {
2490
- slots . default = defaultSlot ;
2497
+ // ignore slots that contains only whitespace
2498
+ for ( var name$1 in slots ) {
2499
+ if ( slots [ name$1 ] . every ( isWhitespace ) ) {
2500
+ delete slots [ name$1 ] ;
2501
+ }
2491
2502
}
2492
2503
return slots
2493
2504
}
@@ -3651,6 +3662,7 @@ function renderSlot (
3651
3662
bindObject
3652
3663
) {
3653
3664
var scopedSlotFn = this . $scopedSlots [ name ] ;
3665
+ var nodes ;
3654
3666
if ( scopedSlotFn ) { // scoped slot
3655
3667
props = props || { } ;
3656
3668
if ( bindObject ) {
@@ -3662,19 +3674,28 @@ function renderSlot (
3662
3674
}
3663
3675
props = extend ( extend ( { } , bindObject ) , props ) ;
3664
3676
}
3665
- return scopedSlotFn ( props ) || fallback
3677
+ nodes = scopedSlotFn ( props ) || fallback ;
3666
3678
} else {
3667
3679
var slotNodes = this . $slots [ name ] ;
3668
3680
// warn duplicate slot usage
3669
- if ( slotNodes && process . env . NODE_ENV !== 'production' ) {
3670
- slotNodes . _rendered && warn (
3671
- "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
3672
- "- this will likely cause render errors." ,
3673
- this
3674
- ) ;
3681
+ if ( slotNodes ) {
3682
+ if ( process . env . NODE_ENV !== 'production' && slotNodes . _rendered ) {
3683
+ warn (
3684
+ "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
3685
+ "- this will likely cause render errors." ,
3686
+ this
3687
+ ) ;
3688
+ }
3675
3689
slotNodes . _rendered = true ;
3676
3690
}
3677
- return slotNodes || fallback
3691
+ nodes = slotNodes || fallback ;
3692
+ }
3693
+
3694
+ var target = props && props . slot ;
3695
+ if ( target ) {
3696
+ return this . $createElement ( 'template' , { slot : target } , nodes )
3697
+ } else {
3698
+ return nodes
3678
3699
}
3679
3700
}
3680
3701
@@ -4829,8 +4850,8 @@ var KeepAlive = {
4829
4850
// check pattern
4830
4851
var name = getComponentName ( componentOptions ) ;
4831
4852
if ( name && (
4832
- ( this . include && ! matches ( this . include , name ) ) ||
4833
- ( this . exclude && matches ( this . exclude , name ) )
4853
+ ( this . exclude && matches ( this . exclude , name ) ) ||
4854
+ ( this . include && ! matches ( this . include , name ) )
4834
4855
) ) {
4835
4856
return vnode
4836
4857
}
@@ -4926,7 +4947,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
4926
4947
}
4927
4948
} ) ;
4928
4949
4929
- Vue$3 . version = '2.5.2 ' ;
4950
+ Vue$3 . version = '2.5.3 ' ;
4930
4951
4931
4952
/* */
4932
4953
@@ -5907,9 +5928,12 @@ function createPatchFunction (backend) {
5907
5928
// create an empty node and replace it
5908
5929
oldVnode = emptyNodeAt ( oldVnode ) ;
5909
5930
}
5931
+
5910
5932
// replacing existing element
5911
5933
var oldElm = oldVnode . elm ;
5912
5934
var parentElm$1 = nodeOps . parentNode ( oldElm ) ;
5935
+
5936
+ // create new node
5913
5937
createElm (
5914
5938
vnode ,
5915
5939
insertedVnodeQueue ,
@@ -5920,9 +5944,8 @@ function createPatchFunction (backend) {
5920
5944
nodeOps . nextSibling ( oldElm )
5921
5945
) ;
5922
5946
5947
+ // update parent placeholder node element, recursively
5923
5948
if ( isDef ( vnode . parent ) ) {
5924
- // component root element replaced.
5925
- // update parent placeholder node element, recursively
5926
5949
var ancestor = vnode . parent ;
5927
5950
var patchable = isPatchable ( vnode ) ;
5928
5951
while ( ancestor ) {
@@ -5951,6 +5974,7 @@ function createPatchFunction (backend) {
5951
5974
}
5952
5975
}
5953
5976
5977
+ // destroy old node
5954
5978
if ( isDef ( parentElm$1 ) ) {
5955
5979
removeVnodes ( parentElm$1 , [ oldVnode ] , 0 , 0 ) ;
5956
5980
} else if ( isDef ( oldVnode . tag ) ) {
@@ -6016,14 +6040,14 @@ function _update (oldVnode, vnode) {
6016
6040
}
6017
6041
} ;
6018
6042
if ( isCreate ) {
6019
- mergeVNodeHook ( vnode . data . hook || ( vnode . data . hook = { } ) , 'insert' , callInsert ) ;
6043
+ mergeVNodeHook ( vnode , 'insert' , callInsert ) ;
6020
6044
} else {
6021
6045
callInsert ( ) ;
6022
6046
}
6023
6047
}
6024
6048
6025
6049
if ( dirsWithPostpatch . length ) {
6026
- mergeVNodeHook ( vnode . data . hook || ( vnode . data . hook = { } ) , 'postpatch' , function ( ) {
6050
+ mergeVNodeHook ( vnode , 'postpatch' , function ( ) {
6027
6051
for ( var i = 0 ; i < dirsWithPostpatch . length ; i ++ ) {
6028
6052
callHook$1 ( dirsWithPostpatch [ i ] , 'componentUpdated' , vnode , oldVnode ) ;
6029
6053
}
@@ -6315,6 +6339,7 @@ function updateDOMListeners (oldVnode, vnode) {
6315
6339
target$1 = vnode . elm ;
6316
6340
normalizeEvents ( on ) ;
6317
6341
updateListeners ( on , oldOn , add$1 , remove$2 , vnode . context ) ;
6342
+ target$1 = undefined ;
6318
6343
}
6319
6344
6320
6345
var events = {
@@ -6920,7 +6945,7 @@ function enter (vnode, toggleDisplay) {
6920
6945
6921
6946
if ( ! vnode . data . show ) {
6922
6947
// remove pending leave element on enter by injecting an insert hook
6923
- mergeVNodeHook ( vnode . data . hook || ( vnode . data . hook = { } ) , 'insert' , function ( ) {
6948
+ mergeVNodeHook ( vnode , 'insert' , function ( ) {
6924
6949
var parent = el . parentNode ;
6925
6950
var pendingNode = parent && parent . _pending && parent . _pending [ vnode . key ] ;
6926
6951
if ( pendingNode &&
@@ -7159,10 +7184,17 @@ if (isIE9) {
7159
7184
} ) ;
7160
7185
}
7161
7186
7162
- var model$1 = {
7163
- inserted : function inserted ( el , binding , vnode ) {
7187
+ var directive = {
7188
+ inserted : function inserted ( el , binding , vnode , oldVnode ) {
7164
7189
if ( vnode . tag === 'select' ) {
7165
- setSelected ( el , binding , vnode . context ) ;
7190
+ // #6903
7191
+ if ( oldVnode . elm && ! oldVnode . elm . _vOptions ) {
7192
+ mergeVNodeHook ( vnode , 'postpatch' , function ( ) {
7193
+ directive . componentUpdated ( el , binding , vnode ) ;
7194
+ } ) ;
7195
+ } else {
7196
+ setSelected ( el , binding , vnode . context ) ;
7197
+ }
7166
7198
el . _vOptions = [ ] . map . call ( el . options , getValue ) ;
7167
7199
} else if ( vnode . tag === 'textarea' || isTextInputType ( el . type ) ) {
7168
7200
el . _vModifiers = binding . modifiers ;
@@ -7183,6 +7215,7 @@ var model$1 = {
7183
7215
}
7184
7216
}
7185
7217
} ,
7218
+
7186
7219
componentUpdated : function componentUpdated ( el , binding , vnode ) {
7187
7220
if ( vnode . tag === 'select' ) {
7188
7221
setSelected ( el , binding , vnode . context ) ;
@@ -7341,7 +7374,7 @@ var show = {
7341
7374
} ;
7342
7375
7343
7376
var platformDirectives = {
7344
- model : model$1 ,
7377
+ model : directive ,
7345
7378
show : show
7346
7379
} ;
7347
7380
0 commit comments