11/*!
2- * Vue.js v2.0.7
2+ * Vue.js v2.0.8
33 * (c) 2014-2016 Evan You
44 * Released under the MIT License.
55 */
@@ -1112,9 +1112,11 @@ function defineReactive$$1 (
11121112 } ,
11131113 set : function reactiveSetter ( newVal ) {
11141114 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 ) ) {
11161117 return
11171118 }
1119+ /* eslint-enable no-self-compare */
11181120 if ( "development" !== 'production' && customSetter ) {
11191121 customSetter ( ) ;
11201122 }
@@ -1208,6 +1210,8 @@ function initState (vm) {
12081210 initWatch ( vm ) ;
12091211}
12101212
1213+ var isReservedProp = makeMap ( 'key,ref,slot' ) ;
1214+
12111215function initProps ( vm ) {
12121216 var props = vm . $options . props ;
12131217 if ( props ) {
@@ -1220,6 +1224,12 @@ function initProps (vm) {
12201224 var key = keys [ i ] ;
12211225 /* istanbul ignore else */
12221226 {
1227+ if ( isReservedProp ( key ) ) {
1228+ warn (
1229+ ( "\"" + key + "\" is a reserved attribute and cannot be used as component prop." ) ,
1230+ vm
1231+ ) ;
1232+ }
12231233 defineReactive$$1 ( vm , key , validateProp ( key , props , propsData , vm ) , function ( ) {
12241234 if ( vm . $parent && ! observerState . isSettingProps ) {
12251235 warn (
@@ -1986,6 +1996,10 @@ function init (vnode, hydrating) {
19861996 if ( ! vnode . child || vnode . child . _isDestroyed ) {
19871997 var child = vnode . child = createComponentInstanceForVnode ( vnode , activeInstance ) ;
19881998 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 ) ;
19892003 }
19902004}
19912005
@@ -2397,6 +2411,7 @@ function renderMixin (Vue) {
23972411 // apply v-bind object
23982412 Vue . prototype . _b = function bindProps (
23992413 data ,
2414+ tag ,
24002415 value ,
24012416 asProp
24022417 ) {
@@ -2414,7 +2429,7 @@ function renderMixin (Vue) {
24142429 if ( key === 'class' || key === 'style' ) {
24152430 data [ key ] = value [ key ] ;
24162431 } else {
2417- var hash = asProp || config . mustUseProp ( key )
2432+ var hash = asProp || config . mustUseProp ( tag , key )
24182433 ? data . domProps || ( data . domProps = { } )
24192434 : data . attrs || ( data . attrs = { } ) ;
24202435 hash [ key ] = value [ key ] ;
@@ -3418,12 +3433,19 @@ Object.defineProperty(Vue$3.prototype, '$isServer', {
34183433 get : function ( ) { return config . _isServer ; }
34193434} ) ;
34203435
3421- Vue$3 . version = '2.0.7 ' ;
3436+ Vue$3 . version = '2.0.8 ' ;
34223437
34233438/* */
34243439
34253440// 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+ } ;
34273449
34283450var isEnumeratedAttr = makeMap ( 'contenteditable,draggable,spellcheck' ) ;
34293451
@@ -3767,7 +3789,7 @@ function registerRef (vnode, isRemoval) {
37673789 }
37683790 } else {
37693791 if ( vnode . data . refInFor ) {
3770- if ( Array . isArray ( refs [ key ] ) ) {
3792+ if ( Array . isArray ( refs [ key ] ) && refs [ key ] . indexOf ( ref ) < 0 ) {
37713793 refs [ key ] . push ( ref ) ;
37723794 } else {
37733795 refs [ key ] = [ ref ] ;
@@ -4557,13 +4579,14 @@ function updateDOMProps (oldVnode, vnode) {
45574579 }
45584580 }
45594581 for ( key in props ) {
4582+ cur = props [ key ] ;
45604583 // ignore children if the node has textContent or innerHTML,
45614584 // as these will throw away existing DOM nodes and cause removal errors
45624585 // 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 }
45654589 }
4566- cur = props [ key ] ;
45674590 if ( key === 'value' ) {
45684591 // store value as _value as well since
45694592 // non-string values will be stringified
@@ -4694,7 +4717,12 @@ function updateStyle (oldVnode, vnode) {
46944717
46954718 var cur , name ;
46964719 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+
46984726 var style = normalizeStyleBinding ( vnode . data . style ) || { } ;
46994727
47004728 vnode . data . style = style . __ob__ ? extend ( { } , style ) : style ;
@@ -5613,7 +5641,7 @@ var TransitionGroup = {
56135641
56145642 updated : function updated ( ) {
56155643 var children = this . prevChildren ;
5616- var moveClass = this . moveClass || ( this . name + '-move' ) ;
5644+ var moveClass = this . moveClass || ( ( this . name || 'v' ) + '-move' ) ;
56175645 if ( ! children . length || ! this . hasMove ( children [ 0 ] . elm , moveClass ) ) {
56185646 return
56195647 }
@@ -6742,7 +6770,7 @@ function processAttrs (el) {
67426770 name = camelize ( name ) ;
67436771 if ( name === 'innerHtml' ) { name = 'innerHTML' ; }
67446772 }
6745- if ( isProp || platformMustUseProp ( name ) ) {
6773+ if ( isProp || platformMustUseProp ( el . tag , name ) ) {
67466774 addProp ( el , name , value ) ;
67476775 } else {
67486776 addAttr ( el , name , value ) ;
@@ -6923,9 +6951,17 @@ function markStaticRoots (node, isInFor) {
69236951 if ( node . static || node . once ) {
69246952 node . staticInFor = isInFor ;
69256953 }
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+ ) ) {
69276961 node . staticRoot = true ;
69286962 return
6963+ } else {
6964+ node . staticRoot = false ;
69296965 }
69306966 if ( node . children ) {
69316967 for ( var i = 0 , l = node . children . length ; i < l ; i ++ ) {
@@ -7055,7 +7091,7 @@ function normalizeKeyCode (key) {
70557091
70567092function bind$2 ( el , dir ) {
70577093 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' : '' ) + ")" )
70597095 } ;
70607096}
70617097
0 commit comments