1267
1267
this . child = undefined ;
1268
1268
this . parent = undefined ;
1269
1269
this . raw = false ;
1270
+ this . isStatic = false ;
1270
1271
// apply construct hook.
1271
1272
// this is applied during render, before patch happens.
1272
1273
// unlike other hooks, this is applied on both client and server.
1662
1663
if ( typeof _ret === "object" ) return _ret . v ;
1663
1664
}
1664
1665
1665
- // merge component management hooks onto the placeholder node
1666
- mergeHooks ( data ) ;
1667
-
1668
1666
// extract listeners, since these needs to be treated as
1669
1667
// child component listeners instead of DOM listeners
1670
1668
var listeners = data . on ;
1671
1669
// replace with listeners with .native modifier
1672
1670
data . on = data . nativeOn ;
1673
1671
1672
+ if ( Ctor . options . abstract ) {
1673
+ // abstract components do not keep anything
1674
+ // other than props & listeners
1675
+ data = { } ;
1676
+ }
1677
+
1678
+ // merge component management hooks onto the placeholder node
1679
+ mergeHooks ( data ) ;
1680
+
1674
1681
// return a placeholder vnode
1675
1682
var name = Ctor . options . name || tag ;
1676
1683
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 } ) ;
1980
1987
// number conversion
1981
1988
Vue . prototype . _n = toNumber ;
1982
1989
1983
- //
1990
+ // render static tree by index
1984
1991
Vue . prototype . _m = function renderStatic ( index ) {
1985
- return this . _staticTrees [ index ] || ( this . _staticTrees [ index ] = this . $options . staticRenderFns [ index ] . call ( this . _renderProxy ) ) ;
1992
+ var tree = this . _staticTrees [ index ] ;
1993
+ if ( ! tree ) {
1994
+ tree = this . _staticTrees [ index ] = this . $options . staticRenderFns [ index ] . call ( this . _renderProxy ) ;
1995
+ tree . isStatic = true ;
1996
+ }
1997
+ return tree ;
1986
1998
} ;
1987
1999
1988
2000
// filter resolution helper
@@ -7183,7 +7195,7 @@ var template = Object.freeze({
7183
7195
}
7184
7196
} ) ;
7185
7197
7186
- Vue . version = '2.0.0-beta.4 ' ;
7198
+ Vue . version = '2.0.0-beta.5 ' ;
7187
7199
7188
7200
// attributes that should be using props for binding
7189
7201
var mustUseProp = makeMap ( 'value,selected,checked,muted' ) ;
@@ -7336,9 +7348,10 @@ var template = Object.freeze({
7336
7348
var isIE9 = UA$1 && UA$1 . indexOf ( 'msie 9.0' ) > 0 ;
7337
7349
var isAndroid = UA$1 && UA$1 . indexOf ( 'android' ) > 0 ;
7338
7350
7339
- // some browsers, e.g. PhantomJS, encodes attribute values for innerHTML
7351
+ // some browsers, e.g. PhantomJS, encodes angular brackets
7352
+ // inside attribute values when retrieving innerHTML.
7340
7353
// this causes problems with the in-browser parser.
7341
- var shouldDecodeAttr = inBrowser ? function ( ) {
7354
+ var shouldDecodeTags = inBrowser ? function ( ) {
7342
7355
var div = document . createElement ( 'div' ) ;
7343
7356
div . innerHTML = '<div a=">">' ;
7344
7357
return div . innerHTML . indexOf ( '>' ) > 0 ;
@@ -7435,6 +7448,9 @@ var nodeOps = Object.freeze({
7435
7448
}
7436
7449
7437
7450
function sameVnode ( vnode1 , vnode2 ) {
7451
+ if ( vnode1 . isStatic || vnode2 . isStatic ) {
7452
+ return vnode1 === vnode2 ;
7453
+ }
7438
7454
return vnode1 . key === vnode2 . key && vnode1 . tag === vnode2 . tag && ! vnode1 . data === ! vnode2 . data ;
7439
7455
}
7440
7456
@@ -7669,8 +7685,8 @@ var nodeOps = Object.freeze({
7669
7685
newStartVnode = newCh [ ++ newStartIdx ] ;
7670
7686
} else {
7671
7687
if ( isUndef ( oldKeyToIdx ) ) oldKeyToIdx = createKeyToOldIdx ( oldCh , oldStartIdx , oldEndIdx ) ;
7672
- idxInOld = oldKeyToIdx [ newStartVnode . key ] ;
7673
- if ( isUndef ( idxInOld ) ) {
7688
+ idxInOld = isDef ( newStartVnode . key ) ? oldKeyToIdx [ newStartVnode . key ] : newStartVnode . isStatic ? oldCh . indexOf ( newStartVnode ) : null ;
7689
+ if ( isUndef ( idxInOld ) || idxInOld === - 1 ) {
7674
7690
// New element
7675
7691
nodeOps . insertBefore ( parentElm , createElm ( newStartVnode , insertedVnodeQueue ) , oldStartVnode . elm ) ;
7676
7692
newStartVnode = newCh [ ++ newStartIdx ] ;
@@ -8240,8 +8256,8 @@ var nodeOps = Object.freeze({
8240
8256
removeClass ( el , cls ) ;
8241
8257
}
8242
8258
8243
- function whenTransitionEnds ( el , cb ) {
8244
- var _getTransitionInfo = getTransitionInfo ( el ) ;
8259
+ function whenTransitionEnds ( el , expectedType , cb ) {
8260
+ var _getTransitionInfo = getTransitionInfo ( el , expectedType ) ;
8245
8261
8246
8262
var type = _getTransitionInfo . type ;
8247
8263
var timeout = _getTransitionInfo . timeout ;
@@ -8269,22 +8285,42 @@ var nodeOps = Object.freeze({
8269
8285
8270
8286
var transformRE = / \b ( t r a n s f o r m | a l l ) ( , | $ ) / ;
8271
8287
8272
- function getTransitionInfo ( el ) {
8288
+ function getTransitionInfo ( el , expectedType ) {
8273
8289
var styles = window . getComputedStyle ( el ) ;
8274
- var transitionProps = styles [ transitionProp + 'Property' ] ;
8275
8290
var transitioneDelays = styles [ transitionProp + 'Delay' ] . split ( ', ' ) ;
8276
8291
var transitionDurations = styles [ transitionProp + 'Duration' ] . split ( ', ' ) ;
8292
+ var transitionTimeout = getTimeout ( transitioneDelays , transitionDurations ) ;
8277
8293
var animationDelays = styles [ animationProp + 'Delay' ] . split ( ', ' ) ;
8278
8294
var animationDurations = styles [ animationProp + 'Duration' ] . split ( ', ' ) ;
8279
- var transitionTimeout = getTimeout ( transitioneDelays , transitionDurations ) ;
8280
8295
var animationTimeout = getTimeout ( animationDelays , animationDurations ) ;
8281
- var timeout = Math . max ( transitionTimeout , animationTimeout ) ;
8282
- var type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null ;
8296
+
8297
+ var type = void 0 ;
8298
+ var timeout = 0 ;
8299
+ var propCount = 0 ;
8300
+ /* istanbul ignore if */
8301
+ if ( expectedType === TRANSITION ) {
8302
+ if ( transitionTimeout > 0 ) {
8303
+ type = TRANSITION ;
8304
+ timeout = transitionTimeout ;
8305
+ propCount = transitionDurations . length ;
8306
+ }
8307
+ } else if ( expectedType === ANIMATION ) {
8308
+ if ( animationTimeout > 0 ) {
8309
+ type = ANIMATION ;
8310
+ timeout = animationTimeout ;
8311
+ propCount = animationDurations . length ;
8312
+ }
8313
+ } else {
8314
+ timeout = Math . max ( transitionTimeout , animationTimeout ) ;
8315
+ type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null ;
8316
+ propCount = type ? type === TRANSITION ? transitionDurations . length : animationDurations . length : 0 ;
8317
+ }
8318
+ var hasTransform = type === TRANSITION && transformRE . test ( styles [ transitionProp + 'Property' ] ) ;
8283
8319
return {
8284
8320
type : type ,
8285
8321
timeout : timeout ,
8286
- propCount : type ? type === TRANSITION ? transitionDurations . length : animationDurations . length : 0 ,
8287
- hasTransform : type === TRANSITION && transformRE . test ( transitionProps )
8322
+ propCount : propCount ,
8323
+ hasTransform : hasTransform
8288
8324
} ;
8289
8325
}
8290
8326
@@ -8318,6 +8354,7 @@ var nodeOps = Object.freeze({
8318
8354
}
8319
8355
8320
8356
var css = data . css ;
8357
+ var type = data . type ;
8321
8358
var enterClass = data . enterClass ;
8322
8359
var enterActiveClass = data . enterActiveClass ;
8323
8360
var appearClass = data . appearClass ;
@@ -8384,7 +8421,7 @@ var nodeOps = Object.freeze({
8384
8421
nextFrame ( function ( ) {
8385
8422
removeTransitionClass ( el , startClass ) ;
8386
8423
if ( ! cb . cancelled && ! userWantsControl ) {
8387
- whenTransitionEnds ( el , cb ) ;
8424
+ whenTransitionEnds ( el , type , cb ) ;
8388
8425
}
8389
8426
} ) ;
8390
8427
}
@@ -8414,6 +8451,7 @@ var nodeOps = Object.freeze({
8414
8451
}
8415
8452
8416
8453
var css = data . css ;
8454
+ var type = data . type ;
8417
8455
var leaveClass = data . leaveClass ;
8418
8456
var leaveActiveClass = data . leaveActiveClass ;
8419
8457
var beforeLeave = data . beforeLeave ;
@@ -8470,7 +8508,7 @@ var nodeOps = Object.freeze({
8470
8508
nextFrame ( function ( ) {
8471
8509
removeTransitionClass ( el , leaveClass ) ;
8472
8510
if ( ! cb . cancelled && ! userWantsControl ) {
8473
- whenTransitionEnds ( el , cb ) ;
8511
+ whenTransitionEnds ( el , type , cb ) ;
8474
8512
}
8475
8513
} ) ;
8476
8514
}
@@ -8682,6 +8720,7 @@ var nodeOps = Object.freeze({
8682
8720
appear : Boolean ,
8683
8721
css : Boolean ,
8684
8722
mode : String ,
8723
+ type : String ,
8685
8724
enterClass : String ,
8686
8725
leaveClass : String ,
8687
8726
enterActiveClass : String ,
@@ -8959,10 +8998,7 @@ var nodeOps = Object.freeze({
8959
8998
8960
8999
var decoder = document . createElement ( 'div' ) ;
8961
9000
8962
- function decodeHTML ( html , asAttribute ) {
8963
- if ( asAttribute ) {
8964
- html = html . replace ( / < / g, '<' ) . replace ( / > / g, '>' ) ;
8965
- }
9001
+ function decodeHTML ( html ) {
8966
9002
decoder . innerHTML = html ;
8967
9003
return decoder . textContent ;
8968
9004
}
@@ -8998,11 +9034,23 @@ var nodeOps = Object.freeze({
8998
9034
8999
9035
var reCache = { } ;
9000
9036
9037
+ var ampRE = / & a m p ; / g;
9038
+ var ltRE = / & l t ; / g;
9039
+ var gtRE = / & g t ; / g;
9040
+
9041
+ function decodeAttr ( value , shouldDecodeTags ) {
9042
+ if ( shouldDecodeTags ) {
9043
+ value = value . replace ( ltRE , '<' ) . replace ( gtRE , '>' ) ;
9044
+ }
9045
+ return value . replace ( ampRE , '&' ) ;
9046
+ }
9047
+
9001
9048
function parseHTML ( html , options ) {
9002
9049
var stack = [ ] ;
9003
9050
var expectHTML = options . expectHTML ;
9004
9051
var isUnaryTag = options . isUnaryTag || no ;
9005
- var shouldDecodeAttr = options . shouldDecodeAttr ;
9052
+ var isFromDOM = options . isFromDOM ;
9053
+ var shouldDecodeTags = options . shouldDecodeTags ;
9006
9054
var index = 0 ;
9007
9055
var last = void 0 ,
9008
9056
lastTag = void 0 ;
@@ -9160,7 +9208,7 @@ var nodeOps = Object.freeze({
9160
9208
var value = args [ 3 ] || args [ 4 ] || args [ 5 ] || '' ;
9161
9209
attrs [ i ] = {
9162
9210
name : args [ 1 ] ,
9163
- value : shouldDecodeAttr ? decodeHTML ( value , true ) : value
9211
+ value : isFromDOM ? decodeAttr ( value , shouldDecodeTags ) : value
9164
9212
} ;
9165
9213
}
9166
9214
@@ -9443,7 +9491,9 @@ var nodeOps = Object.freeze({
9443
9491
var warn$1 = void 0 ;
9444
9492
var platformGetTagNamespace = void 0 ;
9445
9493
var platformMustUseProp = void 0 ;
9494
+ var preTransforms = void 0 ;
9446
9495
var transforms = void 0 ;
9496
+ var postTransforms = void 0 ;
9447
9497
var delimiters = void 0 ;
9448
9498
9449
9499
/**
@@ -9453,7 +9503,9 @@ var nodeOps = Object.freeze({
9453
9503
warn$1 = options . warn || baseWarn ;
9454
9504
platformGetTagNamespace = options . getTagNamespace || no ;
9455
9505
platformMustUseProp = options . mustUseProp || no ;
9506
+ preTransforms = pluckModuleFunction ( options . modules , 'preTransformNode' ) ;
9456
9507
transforms = pluckModuleFunction ( options . modules , 'transformNode' ) ;
9508
+ postTransforms = pluckModuleFunction ( options . modules , 'postTransformNode' ) ;
9457
9509
delimiters = options . delimiters ;
9458
9510
var stack = [ ] ;
9459
9511
var preserveWhitespace = options . preserveWhitespace !== false ;
@@ -9464,7 +9516,8 @@ var nodeOps = Object.freeze({
9464
9516
parseHTML ( template , {
9465
9517
expectHTML : options . expectHTML ,
9466
9518
isUnaryTag : options . isUnaryTag ,
9467
- shouldDecodeAttr : options . shouldDecodeAttr ,
9519
+ isFromDOM : options . isFromDOM ,
9520
+ shouldDecodeTags : options . shouldDecodeTags ,
9468
9521
start : function start ( tag , attrs , unary ) {
9469
9522
// check namespace.
9470
9523
// inherit parent ns if there is one
@@ -9493,6 +9546,11 @@ var nodeOps = Object.freeze({
9493
9546
"development" !== 'production' && warn$1 ( 'Templates should only be responsbile for mapping the state to the ' + 'UI. Avoid placing tags with side-effects in your templates, such as ' + ( '<' + tag + '>.' ) ) ;
9494
9547
}
9495
9548
9549
+ // apply pre-transforms
9550
+ for ( var i = 0 ; i < preTransforms . length ; i ++ ) {
9551
+ preTransforms [ i ] ( element , options ) ;
9552
+ }
9553
+
9496
9554
if ( ! inPre ) {
9497
9555
processPre ( element ) ;
9498
9556
if ( element . pre ) {
@@ -9514,8 +9572,8 @@ var nodeOps = Object.freeze({
9514
9572
processRef ( element ) ;
9515
9573
processSlot ( element ) ;
9516
9574
processComponent ( element ) ;
9517
- for ( var i = 0 ; i < transforms . length ; i ++ ) {
9518
- transforms [ i ] ( element , options ) ;
9575
+ for ( var _i = 0 ; _i < transforms . length ; _i ++ ) {
9576
+ transforms [ _i ] ( element , options ) ;
9519
9577
}
9520
9578
processAttrs ( element ) ;
9521
9579
}
@@ -9548,6 +9606,10 @@ var nodeOps = Object.freeze({
9548
9606
currentParent = element ;
9549
9607
stack . push ( element ) ;
9550
9608
}
9609
+ // apply post-transforms
9610
+ for ( var _i2 = 0 ; _i2 < postTransforms . length ; _i2 ++ ) {
9611
+ postTransforms [ _i2 ] ( element , options ) ;
9612
+ }
9551
9613
} ,
9552
9614
end : function end ( ) {
9553
9615
// remove trailing whitespace
@@ -10585,9 +10647,10 @@ var nodeOps = Object.freeze({
10585
10647
}
10586
10648
if ( template ) {
10587
10649
var _compileToFunctions = compileToFunctions ( template , {
10588
- shouldDecodeAttr : isFromDOM && shouldDecodeAttr ,
10589
- delimiters : options . delimiters ,
10590
- warn : warn
10650
+ warn : warn ,
10651
+ isFromDOM : isFromDOM ,
10652
+ shouldDecodeTags : shouldDecodeTags ,
10653
+ delimiters : options . delimiters
10591
10654
} , this ) ;
10592
10655
10593
10656
Vue . version = '1.0.26' ;
0 commit comments