@@ -1260,6 +1260,7 @@ var VNode = function VNode(tag, data, children, text, elm, ns, context, host, co
1260
1260
this . child = undefined ;
1261
1261
this . parent = undefined ;
1262
1262
this . raw = false ;
1263
+ this . isStatic = false ;
1263
1264
// apply construct hook.
1264
1265
// this is applied during render, before patch happens.
1265
1266
// unlike other hooks, this is applied on both client and server.
@@ -1655,15 +1656,21 @@ function createComponent(Ctor, data, parent, context, host, _children, tag) {
1655
1656
if ( typeof _ret === "object" ) return _ret . v ;
1656
1657
}
1657
1658
1658
- // merge component management hooks onto the placeholder node
1659
- mergeHooks ( data ) ;
1660
-
1661
1659
// extract listeners, since these needs to be treated as
1662
1660
// child component listeners instead of DOM listeners
1663
1661
var listeners = data . on ;
1664
1662
// replace with listeners with .native modifier
1665
1663
data . on = data . nativeOn ;
1666
1664
1665
+ if ( Ctor . options . abstract ) {
1666
+ // abstract components do not keep anything
1667
+ // other than props & listeners
1668
+ data = { } ;
1669
+ }
1670
+
1671
+ // merge component management hooks onto the placeholder node
1672
+ mergeHooks ( data ) ;
1673
+
1667
1674
// return a placeholder vnode
1668
1675
var name = Ctor . options . name || tag ;
1669
1676
var vnode = new VNode ( 'vue-component-' + Ctor . cid + ( name ? '-' + name : '' ) , data , undefined , undefined , undefined , undefined , context , host , { Ctor : Ctor , propsData : propsData , listeners : listeners , parent : parent , tag : tag , children : _children } ) ;
@@ -1973,9 +1980,14 @@ function renderMixin(Vue) {
1973
1980
// number conversion
1974
1981
Vue . prototype . _n = toNumber ;
1975
1982
1976
- //
1983
+ // render static tree by index
1977
1984
Vue . prototype . _m = function renderStatic ( index ) {
1978
- return this . _staticTrees [ index ] || ( this . _staticTrees [ index ] = this . $options . staticRenderFns [ index ] . call ( this . _renderProxy ) ) ;
1985
+ var tree = this . _staticTrees [ index ] ;
1986
+ if ( ! tree ) {
1987
+ tree = this . _staticTrees [ index ] = this . $options . staticRenderFns [ index ] . call ( this . _renderProxy ) ;
1988
+ tree . isStatic = true ;
1989
+ }
1990
+ return tree ;
1979
1991
} ;
1980
1992
1981
1993
// filter resolution helper
@@ -2878,7 +2890,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
2878
2890
}
2879
2891
} ) ;
2880
2892
2881
- Vue . version = '2.0.0-beta.4 ' ;
2893
+ Vue . version = '2.0.0-beta.5 ' ;
2882
2894
2883
2895
// attributes that should be using props for binding
2884
2896
var mustUseProp = makeMap ( 'value,selected,checked,muted' ) ;
@@ -3031,9 +3043,10 @@ var isIE = UA$1 && /msie|trident/.test(UA$1);
3031
3043
var isIE9 = UA$1 && UA$1 . indexOf ( 'msie 9.0' ) > 0 ;
3032
3044
var isAndroid = UA$1 && UA$1 . indexOf ( 'android' ) > 0 ;
3033
3045
3034
- // some browsers, e.g. PhantomJS, encodes attribute values for innerHTML
3046
+ // some browsers, e.g. PhantomJS, encodes angular brackets
3047
+ // inside attribute values when retrieving innerHTML.
3035
3048
// this causes problems with the in-browser parser.
3036
- var shouldDecodeAttr = inBrowser ? function ( ) {
3049
+ var shouldDecodeTags = inBrowser ? function ( ) {
3037
3050
var div = document . createElement ( 'div' ) ;
3038
3051
div . innerHTML = '<div a=">">' ;
3039
3052
return div . innerHTML . indexOf ( '>' ) > 0 ;
@@ -3130,6 +3143,9 @@ function isDef(s) {
3130
3143
}
3131
3144
3132
3145
function sameVnode ( vnode1 , vnode2 ) {
3146
+ if ( vnode1 . isStatic || vnode2 . isStatic ) {
3147
+ return vnode1 === vnode2 ;
3148
+ }
3133
3149
return vnode1 . key === vnode2 . key && vnode1 . tag === vnode2 . tag && ! vnode1 . data === ! vnode2 . data ;
3134
3150
}
3135
3151
@@ -3364,8 +3380,8 @@ function createPatchFunction(backend) {
3364
3380
newStartVnode = newCh [ ++ newStartIdx ] ;
3365
3381
} else {
3366
3382
if ( isUndef ( oldKeyToIdx ) ) oldKeyToIdx = createKeyToOldIdx ( oldCh , oldStartIdx , oldEndIdx ) ;
3367
- idxInOld = oldKeyToIdx [ newStartVnode . key ] ;
3368
- if ( isUndef ( idxInOld ) ) {
3383
+ idxInOld = isDef ( newStartVnode . key ) ? oldKeyToIdx [ newStartVnode . key ] : newStartVnode . isStatic ? oldCh . indexOf ( newStartVnode ) : null ;
3384
+ if ( isUndef ( idxInOld ) || idxInOld === - 1 ) {
3369
3385
// New element
3370
3386
nodeOps . insertBefore ( parentElm , createElm ( newStartVnode , insertedVnodeQueue ) , oldStartVnode . elm ) ;
3371
3387
newStartVnode = newCh [ ++ newStartIdx ] ;
@@ -3935,8 +3951,8 @@ function removeTransitionClass(el, cls) {
3935
3951
removeClass ( el , cls ) ;
3936
3952
}
3937
3953
3938
- function whenTransitionEnds ( el , cb ) {
3939
- var _getTransitionInfo = getTransitionInfo ( el ) ;
3954
+ function whenTransitionEnds ( el , expectedType , cb ) {
3955
+ var _getTransitionInfo = getTransitionInfo ( el , expectedType ) ;
3940
3956
3941
3957
var type = _getTransitionInfo . type ;
3942
3958
var timeout = _getTransitionInfo . timeout ;
@@ -3964,22 +3980,42 @@ function whenTransitionEnds(el, cb) {
3964
3980
3965
3981
var transformRE = / \b ( t r a n s f o r m | a l l ) ( , | $ ) / ;
3966
3982
3967
- function getTransitionInfo ( el ) {
3983
+ function getTransitionInfo ( el , expectedType ) {
3968
3984
var styles = window . getComputedStyle ( el ) ;
3969
- var transitionProps = styles [ transitionProp + 'Property' ] ;
3970
3985
var transitioneDelays = styles [ transitionProp + 'Delay' ] . split ( ', ' ) ;
3971
3986
var transitionDurations = styles [ transitionProp + 'Duration' ] . split ( ', ' ) ;
3987
+ var transitionTimeout = getTimeout ( transitioneDelays , transitionDurations ) ;
3972
3988
var animationDelays = styles [ animationProp + 'Delay' ] . split ( ', ' ) ;
3973
3989
var animationDurations = styles [ animationProp + 'Duration' ] . split ( ', ' ) ;
3974
- var transitionTimeout = getTimeout ( transitioneDelays , transitionDurations ) ;
3975
3990
var animationTimeout = getTimeout ( animationDelays , animationDurations ) ;
3976
- var timeout = Math . max ( transitionTimeout , animationTimeout ) ;
3977
- var type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null ;
3991
+
3992
+ var type = void 0 ;
3993
+ var timeout = 0 ;
3994
+ var propCount = 0 ;
3995
+ /* istanbul ignore if */
3996
+ if ( expectedType === TRANSITION ) {
3997
+ if ( transitionTimeout > 0 ) {
3998
+ type = TRANSITION ;
3999
+ timeout = transitionTimeout ;
4000
+ propCount = transitionDurations . length ;
4001
+ }
4002
+ } else if ( expectedType === ANIMATION ) {
4003
+ if ( animationTimeout > 0 ) {
4004
+ type = ANIMATION ;
4005
+ timeout = animationTimeout ;
4006
+ propCount = animationDurations . length ;
4007
+ }
4008
+ } else {
4009
+ timeout = Math . max ( transitionTimeout , animationTimeout ) ;
4010
+ type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null ;
4011
+ propCount = type ? type === TRANSITION ? transitionDurations . length : animationDurations . length : 0 ;
4012
+ }
4013
+ var hasTransform = type === TRANSITION && transformRE . test ( styles [ transitionProp + 'Property' ] ) ;
3978
4014
return {
3979
4015
type : type ,
3980
4016
timeout : timeout ,
3981
- propCount : type ? type === TRANSITION ? transitionDurations . length : animationDurations . length : 0 ,
3982
- hasTransform : type === TRANSITION && transformRE . test ( transitionProps )
4017
+ propCount : propCount ,
4018
+ hasTransform : hasTransform
3983
4019
} ;
3984
4020
}
3985
4021
@@ -4013,6 +4049,7 @@ function enter(vnode) {
4013
4049
}
4014
4050
4015
4051
var css = data . css ;
4052
+ var type = data . type ;
4016
4053
var enterClass = data . enterClass ;
4017
4054
var enterActiveClass = data . enterActiveClass ;
4018
4055
var appearClass = data . appearClass ;
@@ -4079,7 +4116,7 @@ function enter(vnode) {
4079
4116
nextFrame ( function ( ) {
4080
4117
removeTransitionClass ( el , startClass ) ;
4081
4118
if ( ! cb . cancelled && ! userWantsControl ) {
4082
- whenTransitionEnds ( el , cb ) ;
4119
+ whenTransitionEnds ( el , type , cb ) ;
4083
4120
}
4084
4121
} ) ;
4085
4122
}
@@ -4109,6 +4146,7 @@ function leave(vnode, rm) {
4109
4146
}
4110
4147
4111
4148
var css = data . css ;
4149
+ var type = data . type ;
4112
4150
var leaveClass = data . leaveClass ;
4113
4151
var leaveActiveClass = data . leaveActiveClass ;
4114
4152
var beforeLeave = data . beforeLeave ;
@@ -4165,7 +4203,7 @@ function leave(vnode, rm) {
4165
4203
nextFrame ( function ( ) {
4166
4204
removeTransitionClass ( el , leaveClass ) ;
4167
4205
if ( ! cb . cancelled && ! userWantsControl ) {
4168
- whenTransitionEnds ( el , cb ) ;
4206
+ whenTransitionEnds ( el , type , cb ) ;
4169
4207
}
4170
4208
} ) ;
4171
4209
}
@@ -4377,6 +4415,7 @@ var transitionProps = {
4377
4415
appear : Boolean ,
4378
4416
css : Boolean ,
4379
4417
mode : String ,
4418
+ type : String ,
4380
4419
enterClass : String ,
4381
4420
leaveClass : String ,
4382
4421
enterActiveClass : String ,
0 commit comments