1
1
/*!
2
- * Vue.js v1.0.12
2
+ * Vue.js v1.0.13
3
3
* (c) 2015 Evan You
4
4
* Released under the MIT License.
5
5
*/
@@ -847,22 +847,10 @@ function inlineFilters(exp, single) {
847
847
}
848
848
}
849
849
850
- /**
851
- * Replace all interpolation tags in a piece of text.
852
- *
853
- * @param {String } text
854
- * @return {String }
855
- */
856
-
857
- function removeTags ( text ) {
858
- return text . replace ( tagRE , '' ) ;
859
- }
860
-
861
850
var text$1 = Object . freeze ( {
862
851
compileRegex : compileRegex ,
863
852
parseText : parseText ,
864
- tokensToExp : tokensToExp ,
865
- removeTags : removeTags
853
+ tokensToExp : tokensToExp
866
854
} ) ;
867
855
868
856
var delimiters = [ '{{' , '}}' ] ;
@@ -1963,7 +1951,7 @@ var arrayMethods = Object.create(arrayProto)
1963
1951
1964
1952
def ( arrayProto , '$set' , function $set ( index , val ) {
1965
1953
if ( index >= this . length ) {
1966
- this . length = index + 1 ;
1954
+ this . length = Number ( index ) + 1 ;
1967
1955
}
1968
1956
return this . splice ( index , 1 , val ) [ 0 ] ;
1969
1957
} ) ;
@@ -2079,8 +2067,7 @@ function Observer(value) {
2079
2067
2080
2068
Observer . prototype . walk = function ( obj ) {
2081
2069
var keys = Object . keys ( obj ) ;
2082
- var i = keys . length ;
2083
- while ( i -- ) {
2070
+ for ( var i = 0 , l = keys . length ; i < l ; i ++ ) {
2084
2071
this . convert ( keys [ i ] , obj [ keys [ i ] ] ) ;
2085
2072
}
2086
2073
} ;
@@ -2092,8 +2079,7 @@ Observer.prototype.walk = function (obj) {
2092
2079
*/
2093
2080
2094
2081
Observer . prototype . observeArray = function ( items ) {
2095
- var i = items . length ;
2096
- while ( i -- ) {
2082
+ for ( var i = 0 , l = items . length ; i < l ; i ++ ) {
2097
2083
observe ( items [ i ] ) ;
2098
2084
}
2099
2085
} ;
@@ -2157,10 +2143,8 @@ function protoAugment(target, src) {
2157
2143
*/
2158
2144
2159
2145
function copyAugment ( target , src , keys ) {
2160
- var i = keys . length ;
2161
- var key ;
2162
- while ( i -- ) {
2163
- key = keys [ i ] ;
2146
+ for ( var i = 0 , l = keys . length ; i < l ; i ++ ) {
2147
+ var key = keys [ i ] ;
2164
2148
def ( target , key , src [ key ] ) ;
2165
2149
}
2166
2150
}
@@ -3344,7 +3328,7 @@ function traverse(val) {
3344
3328
var cloak = {
3345
3329
bind : function bind ( ) {
3346
3330
var el = this . el ;
3347
- this . vm . $once ( 'hook:compiled' , function ( ) {
3331
+ this . vm . $once ( 'pre- hook:compiled' , function ( ) {
3348
3332
el . removeAttribute ( 'v-cloak' ) ;
3349
3333
} ) ;
3350
3334
}
@@ -3356,9 +3340,20 @@ var ref = {
3356
3340
}
3357
3341
} ;
3358
3342
3343
+ var ON = 700 ;
3344
+ var MODEL = 800 ;
3345
+ var BIND = 850 ;
3346
+ var TRANSITION = 1100 ;
3347
+ var EL = 1500 ;
3348
+ var COMPONENT = 1500 ;
3349
+ var PARTIAL = 1750 ;
3350
+ var SLOT = 1750 ;
3351
+ var FOR = 2000 ;
3352
+ var IF = 2000 ;
3353
+
3359
3354
var el = {
3360
3355
3361
- priority : 1500 ,
3356
+ priority : EL ,
3362
3357
3363
3358
bind : function bind ( ) {
3364
3359
/* istanbul ignore if */
@@ -3509,7 +3504,7 @@ var modelProps = {
3509
3504
3510
3505
var bind = {
3511
3506
3512
- priority : 850 ,
3507
+ priority : BIND ,
3513
3508
3514
3509
bind : function bind ( ) {
3515
3510
var attr = this . arg ;
@@ -3559,34 +3554,43 @@ var bind = {
3559
3554
handleObject : style . handleObject ,
3560
3555
3561
3556
handleSingle : function handleSingle ( attr , value ) {
3562
- if ( ! this . descriptor . interp && attrWithPropsRE . test ( attr ) && attr in this . el ) {
3563
- this . el [ attr ] = attr === 'value' ? value == null // IE9 will set input.value to "null" for null...
3557
+ var el = this . el ;
3558
+ var interp = this . descriptor . interp ;
3559
+ if ( ! interp && attrWithPropsRE . test ( attr ) && attr in el ) {
3560
+ el [ attr ] = attr === 'value' ? value == null // IE9 will set input.value to "null" for null...
3564
3561
? '' : value : value ;
3565
3562
}
3566
3563
// set model props
3567
3564
var modelProp = modelProps [ attr ] ;
3568
- if ( modelProp ) {
3569
- this . el [ modelProp ] = value ;
3565
+ if ( ! interp && modelProp ) {
3566
+ el [ modelProp ] = value ;
3570
3567
// update v-model if present
3571
- var model = this . el . __v_model ;
3568
+ var model = el . __v_model ;
3572
3569
if ( model ) {
3573
3570
model . listener ( ) ;
3574
3571
}
3575
3572
}
3576
3573
// do not set value attribute for textarea
3577
- if ( attr === 'value' && this . el . tagName === 'TEXTAREA' ) {
3578
- this . el . removeAttribute ( attr ) ;
3574
+ if ( attr === 'value' && el . tagName === 'TEXTAREA' ) {
3575
+ el . removeAttribute ( attr ) ;
3579
3576
return ;
3580
3577
}
3581
3578
// update attribute
3582
3579
if ( value != null && value !== false ) {
3583
- if ( xlinkRE . test ( attr ) ) {
3584
- this . el . setAttributeNS ( xlinkNS , attr , value ) ;
3580
+ if ( attr === 'class' ) {
3581
+ // handle edge case #1960:
3582
+ // class interpolation should not overwrite Vue transition class
3583
+ if ( el . __v_trans ) {
3584
+ value += ' ' + el . __v_trans . id + '-transition' ;
3585
+ }
3586
+ setClass ( el , value ) ;
3587
+ } else if ( xlinkRE . test ( attr ) ) {
3588
+ el . setAttributeNS ( xlinkNS , attr , value ) ;
3585
3589
} else {
3586
- this . el . setAttribute ( attr , value ) ;
3590
+ el . setAttribute ( attr , value ) ;
3587
3591
}
3588
3592
} else {
3589
- this . el . removeAttribute ( attr ) ;
3593
+ el . removeAttribute ( attr ) ;
3590
3594
}
3591
3595
}
3592
3596
} ;
@@ -3642,7 +3646,7 @@ function preventFilter(handler) {
3642
3646
var on = {
3643
3647
3644
3648
acceptStatement : true ,
3645
- priority : 700 ,
3649
+ priority : ON ,
3646
3650
3647
3651
bind : function bind ( ) {
3648
3652
// deal with iframes
@@ -4033,7 +4037,7 @@ var handlers = {
4033
4037
4034
4038
var model = {
4035
4039
4036
- priority : 800 ,
4040
+ priority : MODEL ,
4037
4041
twoWay : true ,
4038
4042
handlers : handlers ,
4039
4043
params : [ 'lazy' , 'number' , 'debounce' ] ,
@@ -4605,7 +4609,7 @@ FragmentFactory.prototype.create = function (host, scope, parentFrag) {
4605
4609
4606
4610
var vIf = {
4607
4611
4608
- priority : 2000 ,
4612
+ priority : IF ,
4609
4613
4610
4614
bind : function bind ( ) {
4611
4615
var el = this . el ;
@@ -4668,7 +4672,7 @@ var uid$1 = 0;
4668
4672
4669
4673
var vFor = {
4670
4674
4671
- priority : 2000 ,
4675
+ priority : FOR ,
4672
4676
4673
4677
params : [ 'track-by' , 'stagger' , 'enter-stagger' , 'leave-stagger' ] ,
4674
4678
@@ -5663,7 +5667,7 @@ function isHidden(el) {
5663
5667
5664
5668
var transition = {
5665
5669
5666
- priority : 1100 ,
5670
+ priority : TRANSITION ,
5667
5671
5668
5672
update : function update ( id , oldId ) {
5669
5673
var el = this . el ;
@@ -5714,7 +5718,7 @@ var propDef = {
5714
5718
// important: defer the child watcher creation until
5715
5719
// the created hook (after data observation)
5716
5720
var self = this ;
5717
- child . $once ( 'hook:created' , function ( ) {
5721
+ child . $once ( 'pre- hook:created' , function ( ) {
5718
5722
self . childWatcher = new Watcher ( child , childKey , function ( val ) {
5719
5723
parentWatcher . set ( val ) ;
5720
5724
} , {
@@ -5737,7 +5741,7 @@ var propDef = {
5737
5741
5738
5742
var component = {
5739
5743
5740
- priority : 1500 ,
5744
+ priority : COMPONENT ,
5741
5745
5742
5746
params : [ 'keep-alive' , 'transition-mode' , 'inline-template' ] ,
5743
5747
@@ -6930,12 +6934,8 @@ function compileDirectives(attrs, options) {
6930
6934
// attribute interpolations
6931
6935
if ( tokens ) {
6932
6936
value = tokensToExp ( tokens ) ;
6933
- if ( name === 'class' ) {
6934
- pushDir ( 'class' , internalDirectives [ 'class' ] , true ) ;
6935
- } else {
6936
- arg = name ;
6937
- pushDir ( 'bind' , publicDirectives . bind , true ) ;
6938
- }
6937
+ arg = name ;
6938
+ pushDir ( 'bind' , publicDirectives . bind , true ) ;
6939
6939
// warn against mixing mustaches with v-bind
6940
6940
if ( process . env . NODE_ENV !== 'production' ) {
6941
6941
if ( name === 'class' && Array . prototype . some . call ( attrs , function ( attr ) {
@@ -7596,6 +7596,7 @@ function eventsMixin (Vue) {
7596
7596
*/
7597
7597
7598
7598
Vue . prototype . _callHook = function ( hook ) {
7599
+ this . $emit ( 'pre-hook:' + hook ) ;
7599
7600
var handlers = this . $options [ hook ] ;
7600
7601
if ( handlers ) {
7601
7602
for ( var i = 0 , j = handlers . length ; i < j ; i ++ ) {
@@ -7672,13 +7673,7 @@ Directive.prototype._bind = function () {
7672
7673
// remove attribute
7673
7674
if ( ( name !== 'cloak' || this . vm . _isCompiled ) && this . el && this . el . removeAttribute ) {
7674
7675
var attr = descriptor . attr || 'v-' + name ;
7675
- if ( attr !== 'class' ) {
7676
- this . el . removeAttribute ( attr ) ;
7677
- } else {
7678
- // for class interpolations, only remove the parts that
7679
- // need to be interpolated.
7680
- setClass ( this . el , removeTags ( this . el . getAttribute ( 'class' ) ) . trim ( ) . replace ( / \s + / g, ' ' ) ) ;
7681
- }
7676
+ this . el . removeAttribute ( attr ) ;
7682
7677
}
7683
7678
7684
7679
// copy def properties
@@ -7788,7 +7783,8 @@ Directive.prototype._setupParamWatcher = function (key, expression) {
7788
7783
called = true ;
7789
7784
}
7790
7785
} , {
7791
- immediate : true
7786
+ immediate : true ,
7787
+ user : false
7792
7788
} ) ; ( this . _paramUnwatchFns || ( this . _paramUnwatchFns = [ ] ) ) . push ( unwatch ) ;
7793
7789
} ;
7794
7790
@@ -8477,7 +8473,8 @@ function dataAPI (Vue) {
8477
8473
var watcher = new Watcher ( vm , expOrFn , cb , {
8478
8474
deep : options && options . deep ,
8479
8475
sync : options && options . sync ,
8480
- filters : parsed && parsed . filters
8476
+ filters : parsed && parsed . filters ,
8477
+ user : ! options || options . user !== false
8481
8478
} ) ;
8482
8479
if ( options && options . immediate ) {
8483
8480
cb . call ( vm , watcher . value ) ;
@@ -9241,7 +9238,7 @@ var filters = {
9241
9238
9242
9239
var partial = {
9243
9240
9244
- priority : 1750 ,
9241
+ priority : PARTIAL ,
9245
9242
9246
9243
params : [ 'name' ] ,
9247
9244
@@ -9292,7 +9289,7 @@ var partial = {
9292
9289
9293
9290
var slot = {
9294
9291
9295
- priority : 1750 ,
9292
+ priority : SLOT ,
9296
9293
9297
9294
bind : function bind ( ) {
9298
9295
var host = this . vm ;
@@ -9397,7 +9394,7 @@ var elementDirectives = {
9397
9394
partial : partial
9398
9395
} ;
9399
9396
9400
- Vue . version = '1.0.12 ' ;
9397
+ Vue . version = '1.0.13 ' ;
9401
9398
9402
9399
/**
9403
9400
* Vue and every constructor that extends Vue has an
0 commit comments