1
1
/*!
2
- * Vue.js v2.0.7
2
+ * Vue.js v2.0.8
3
3
* (c) 2014-2016 Evan You
4
4
* Released under the MIT License.
5
5
*/
@@ -1112,9 +1112,11 @@ function defineReactive$$1 (
1112
1112
} ,
1113
1113
set : function reactiveSetter ( newVal ) {
1114
1114
var value = getter ? getter . call ( obj ) : val ;
1115
- if ( newVal === value ) {
1115
+ /* eslint-disable no-self-compare */
1116
+ if ( newVal === value || ( newVal !== newVal && value !== value ) ) {
1116
1117
return
1117
1118
}
1119
+ /* eslint-enable no-self-compare */
1118
1120
if ( "development" !== 'production' && customSetter ) {
1119
1121
customSetter ( ) ;
1120
1122
}
@@ -1208,6 +1210,8 @@ function initState (vm) {
1208
1210
initWatch ( vm ) ;
1209
1211
}
1210
1212
1213
+ var isReservedProp = makeMap ( 'key,ref,slot' ) ;
1214
+
1211
1215
function initProps ( vm ) {
1212
1216
var props = vm . $options . props ;
1213
1217
if ( props ) {
@@ -1220,6 +1224,12 @@ function initProps (vm) {
1220
1224
var key = keys [ i ] ;
1221
1225
/* istanbul ignore else */
1222
1226
{
1227
+ if ( isReservedProp ( key ) ) {
1228
+ warn (
1229
+ ( "\"" + key + "\" is a reserved attribute and cannot be used as component prop." ) ,
1230
+ vm
1231
+ ) ;
1232
+ }
1223
1233
defineReactive$$1 ( vm , key , validateProp ( key , props , propsData , vm ) , function ( ) {
1224
1234
if ( vm . $parent && ! observerState . isSettingProps ) {
1225
1235
warn (
@@ -1986,6 +1996,10 @@ function init (vnode, hydrating) {
1986
1996
if ( ! vnode . child || vnode . child . _isDestroyed ) {
1987
1997
var child = vnode . child = createComponentInstanceForVnode ( vnode , activeInstance ) ;
1988
1998
child . $mount ( hydrating ? vnode . elm : undefined , hydrating ) ;
1999
+ } else if ( vnode . data . keepAlive ) {
2000
+ // kept-alive components, treat as a patch
2001
+ var mountedNode = vnode ; // work around flow
2002
+ prepatch ( mountedNode , mountedNode ) ;
1989
2003
}
1990
2004
}
1991
2005
@@ -2397,6 +2411,7 @@ function renderMixin (Vue) {
2397
2411
// apply v-bind object
2398
2412
Vue . prototype . _b = function bindProps (
2399
2413
data ,
2414
+ tag ,
2400
2415
value ,
2401
2416
asProp
2402
2417
) {
@@ -2414,7 +2429,7 @@ function renderMixin (Vue) {
2414
2429
if ( key === 'class' || key === 'style' ) {
2415
2430
data [ key ] = value [ key ] ;
2416
2431
} else {
2417
- var hash = asProp || config . mustUseProp ( key )
2432
+ var hash = asProp || config . mustUseProp ( tag , key )
2418
2433
? data . domProps || ( data . domProps = { } )
2419
2434
: data . attrs || ( data . attrs = { } ) ;
2420
2435
hash [ key ] = value [ key ] ;
@@ -3418,12 +3433,19 @@ Object.defineProperty(Vue$3.prototype, '$isServer', {
3418
3433
get : function ( ) { return config . _isServer ; }
3419
3434
} ) ;
3420
3435
3421
- Vue$3 . version = '2.0.7 ' ;
3436
+ Vue$3 . version = '2.0.8 ' ;
3422
3437
3423
3438
/* */
3424
3439
3425
3440
// attributes that should be using props for binding
3426
- var mustUseProp = makeMap ( 'value,selected,checked,muted' ) ;
3441
+ var mustUseProp = function ( tag , attr ) {
3442
+ return (
3443
+ ( attr === 'value' && ( tag === 'input' || tag === 'textarea' || tag === 'option' ) ) ||
3444
+ ( attr === 'selected' && tag === 'option' ) ||
3445
+ ( attr === 'checked' && tag === 'input' ) ||
3446
+ ( attr === 'muted' && tag === 'video' )
3447
+ )
3448
+ } ;
3427
3449
3428
3450
var isEnumeratedAttr = makeMap ( 'contenteditable,draggable,spellcheck' ) ;
3429
3451
@@ -3767,7 +3789,7 @@ function registerRef (vnode, isRemoval) {
3767
3789
}
3768
3790
} else {
3769
3791
if ( vnode . data . refInFor ) {
3770
- if ( Array . isArray ( refs [ key ] ) ) {
3792
+ if ( Array . isArray ( refs [ key ] ) && refs [ key ] . indexOf ( ref ) < 0 ) {
3771
3793
refs [ key ] . push ( ref ) ;
3772
3794
} else {
3773
3795
refs [ key ] = [ ref ] ;
@@ -4557,13 +4579,14 @@ function updateDOMProps (oldVnode, vnode) {
4557
4579
}
4558
4580
}
4559
4581
for ( key in props ) {
4582
+ cur = props [ key ] ;
4560
4583
// ignore children if the node has textContent or innerHTML,
4561
4584
// as these will throw away existing DOM nodes and cause removal errors
4562
4585
// on subsequent patches (#3360)
4563
- if ( ( key === 'textContent' || key === 'innerHTML' ) && vnode . children ) {
4564
- vnode . children . length = 0 ;
4586
+ if ( key === 'textContent' || key === 'innerHTML' ) {
4587
+ if ( vnode . children ) { vnode . children . length = 0 ; }
4588
+ if ( cur === oldProps [ key ] ) { continue }
4565
4589
}
4566
- cur = props [ key ] ;
4567
4590
if ( key === 'value' ) {
4568
4591
// store value as _value as well since
4569
4592
// non-string values will be stringified
@@ -4694,7 +4717,12 @@ function updateStyle (oldVnode, vnode) {
4694
4717
4695
4718
var cur , name ;
4696
4719
var el = vnode . elm ;
4697
- var oldStyle = oldVnode . data . style || { } ;
4720
+ var oldStaticStyle = oldVnode . data . staticStyle ;
4721
+ var oldStyleBinding = oldVnode . data . style || { } ;
4722
+
4723
+ // if static style exists, stylebinding already merged into it when doing normalizeStyleData
4724
+ var oldStyle = oldStaticStyle || oldStyleBinding ;
4725
+
4698
4726
var style = normalizeStyleBinding ( vnode . data . style ) || { } ;
4699
4727
4700
4728
vnode . data . style = style . __ob__ ? extend ( { } , style ) : style ;
@@ -5613,7 +5641,7 @@ var TransitionGroup = {
5613
5641
5614
5642
updated : function updated ( ) {
5615
5643
var children = this . prevChildren ;
5616
- var moveClass = this . moveClass || ( this . name + '-move' ) ;
5644
+ var moveClass = this . moveClass || ( ( this . name || 'v' ) + '-move' ) ;
5617
5645
if ( ! children . length || ! this . hasMove ( children [ 0 ] . elm , moveClass ) ) {
5618
5646
return
5619
5647
}
@@ -6742,7 +6770,7 @@ function processAttrs (el) {
6742
6770
name = camelize ( name ) ;
6743
6771
if ( name === 'innerHtml' ) { name = 'innerHTML' ; }
6744
6772
}
6745
- if ( isProp || platformMustUseProp ( name ) ) {
6773
+ if ( isProp || platformMustUseProp ( el . tag , name ) ) {
6746
6774
addProp ( el , name , value ) ;
6747
6775
} else {
6748
6776
addAttr ( el , name , value ) ;
@@ -6923,9 +6951,17 @@ function markStaticRoots (node, isInFor) {
6923
6951
if ( node . static || node . once ) {
6924
6952
node . staticInFor = isInFor ;
6925
6953
}
6926
- if ( node . static ) {
6954
+ // For a node to qualify as a static root, it should have children that
6955
+ // are not just static text. Otherwise the cost of hoisting out will
6956
+ // outweigh the benefits and it's better off to just always render it fresh.
6957
+ if ( node . static && node . children . length && ! (
6958
+ node . children . length === 1 &&
6959
+ node . children [ 0 ] . type === 3
6960
+ ) ) {
6927
6961
node . staticRoot = true ;
6928
6962
return
6963
+ } else {
6964
+ node . staticRoot = false ;
6929
6965
}
6930
6966
if ( node . children ) {
6931
6967
for ( var i = 0 , l = node . children . length ; i < l ; i ++ ) {
@@ -7055,7 +7091,7 @@ function normalizeKeyCode (key) {
7055
7091
7056
7092
function bind$2 ( el , dir ) {
7057
7093
el . wrapData = function ( code ) {
7058
- return ( "_b(" + code + "," + ( dir . value ) + ( dir . modifiers && dir . modifiers . prop ? ',true' : '' ) + ")" )
7094
+ return ( "_b(" + code + ",'" + ( el . tag ) + "', " + ( dir . value ) + ( dir . modifiers && dir . modifiers . prop ? ',true' : '' ) + ")" )
7059
7095
} ;
7060
7096
}
7061
7097
0 commit comments