1
1
/*!
2
- * Vue.js v0.12.15
2
+ * Vue.js v0.12.16
3
3
* (c) 2015 Evan You
4
4
* Released under the MIT License.
5
5
*/
@@ -1000,7 +1000,7 @@ return /******/ (function(modules) { // webpackBootstrap
1000
1000
* @param {Vue } [vm]
1001
1001
*/
1002
1002
1003
- var strats = Object . create ( null )
1003
+ var strats = config . optionMergeStrategies = Object . create ( null )
1004
1004
1005
1005
/**
1006
1006
* Helper that recursively merges two data objects together.
@@ -1642,6 +1642,16 @@ return /******/ (function(modules) { // webpackBootstrap
1642
1642
return this
1643
1643
}
1644
1644
1645
+ /**
1646
+ * Apply a global mixin by merging it into the default
1647
+ * options.
1648
+ */
1649
+
1650
+ exports . mixin = function ( mixin ) {
1651
+ var Vue = _ . Vue
1652
+ Vue . options = _ . mergeOptions ( Vue . options , mixin )
1653
+ }
1654
+
1645
1655
/**
1646
1656
* Create asset registration methods with the following
1647
1657
* signature:
@@ -2276,22 +2286,26 @@ return /******/ (function(modules) { // webpackBootstrap
2276
2286
allOneTime = false
2277
2287
}
2278
2288
}
2289
+ var linker
2290
+ if ( allOneTime ) {
2291
+ linker = function ( vm , el ) {
2292
+ el . setAttribute ( name , vm . $interpolate ( value ) )
2293
+ }
2294
+ } else {
2295
+ linker = function ( vm , el ) {
2296
+ var exp = textParser . tokensToExp ( tokens , vm )
2297
+ var desc = isClass
2298
+ ? dirParser . parse ( exp ) [ 0 ]
2299
+ : dirParser . parse ( name + ':' + exp ) [ 0 ]
2300
+ if ( isClass ) {
2301
+ desc . _rawClass = value
2302
+ }
2303
+ vm . _bindDir ( dirName , el , desc , def )
2304
+ }
2305
+ }
2279
2306
return {
2280
2307
def : def ,
2281
- _link : allOneTime
2282
- ? function ( vm , el ) {
2283
- el . setAttribute ( name , vm . $interpolate ( value ) )
2284
- }
2285
- : function ( vm , el ) {
2286
- var exp = textParser . tokensToExp ( tokens , vm )
2287
- var desc = isClass
2288
- ? dirParser . parse ( exp ) [ 0 ]
2289
- : dirParser . parse ( name + ':' + exp ) [ 0 ]
2290
- if ( isClass ) {
2291
- desc . _rawClass = value
2292
- }
2293
- vm . _bindDir ( dirName , el , desc , def )
2294
- }
2308
+ _link : linker
2295
2309
}
2296
2310
}
2297
2311
}
@@ -2623,11 +2637,13 @@ return /******/ (function(modules) { // webpackBootstrap
2623
2637
*/
2624
2638
2625
2639
exports . tokensToExp = function ( tokens , vm ) {
2626
- return tokens . length > 1
2627
- ? tokens . map ( function ( token ) {
2628
- return formatToken ( token , vm )
2629
- } ) . join ( '+' )
2630
- : formatToken ( tokens [ 0 ] , vm , true )
2640
+ if ( tokens . length > 1 ) {
2641
+ return tokens . map ( function ( token ) {
2642
+ return formatToken ( token , vm )
2643
+ } ) . join ( '+' )
2644
+ } else {
2645
+ return formatToken ( tokens [ 0 ] , vm , true )
2646
+ }
2631
2647
}
2632
2648
2633
2649
/**
@@ -3096,7 +3112,7 @@ return /******/ (function(modules) { // webpackBootstrap
3096
3112
this . id = ++ uid // uid for batching
3097
3113
this . active = true
3098
3114
this . dirty = this . lazy // for lazy watchers
3099
- this . deps = [ ]
3115
+ this . deps = Object . create ( null )
3100
3116
this . newDeps = null
3101
3117
this . prevError = null // for async error stacks
3102
3118
// parse expression for getter/setter
@@ -3123,15 +3139,12 @@ return /******/ (function(modules) { // webpackBootstrap
3123
3139
*/
3124
3140
3125
3141
Watcher . prototype . addDep = function ( dep ) {
3126
- var newDeps = this . newDeps
3127
- var old = this . deps
3128
- if ( _ . indexOf ( newDeps , dep ) < 0 ) {
3129
- newDeps . push ( dep )
3130
- var i = _ . indexOf ( old , dep )
3131
- if ( i < 0 ) {
3142
+ var id = dep . id
3143
+ if ( ! this . newDeps [ id ] ) {
3144
+ this . newDeps [ id ] = dep
3145
+ if ( ! this . deps [ id ] ) {
3146
+ this . deps [ id ] = dep
3132
3147
dep . addSub ( this )
3133
- } else {
3134
- old [ i ] = null
3135
3148
}
3136
3149
}
3137
3150
}
@@ -3209,7 +3222,7 @@ return /******/ (function(modules) { // webpackBootstrap
3209
3222
3210
3223
Watcher . prototype . beforeGet = function ( ) {
3211
3224
Dep . target = this
3212
- this . newDeps = [ ]
3225
+ this . newDeps = Object . create ( null )
3213
3226
}
3214
3227
3215
3228
/**
@@ -3218,15 +3231,15 @@ return /******/ (function(modules) { // webpackBootstrap
3218
3231
3219
3232
Watcher . prototype . afterGet = function ( ) {
3220
3233
Dep . target = null
3221
- var i = this . deps . length
3234
+ var ids = Object . keys ( this . deps )
3235
+ var i = ids . length
3222
3236
while ( i -- ) {
3223
- var dep = this . deps [ i ]
3224
- if ( dep ) {
3225
- dep . removeSub ( this )
3237
+ var id = ids [ i ]
3238
+ if ( ! this . newDeps [ id ] ) {
3239
+ this . deps [ id ] . removeSub ( this )
3226
3240
}
3227
3241
}
3228
3242
this . deps = this . newDeps
3229
- this . newDeps = null
3230
3243
}
3231
3244
3232
3245
/**
@@ -3321,9 +3334,10 @@ return /******/ (function(modules) { // webpackBootstrap
3321
3334
*/
3322
3335
3323
3336
Watcher . prototype . depend = function ( ) {
3324
- var i = this . deps . length
3337
+ var depIds = Object . keys ( this . deps )
3338
+ var i = depIds . length
3325
3339
while ( i -- ) {
3326
- this . deps [ i ] . depend ( )
3340
+ this . deps [ depIds [ i ] ] . depend ( )
3327
3341
}
3328
3342
}
3329
3343
@@ -3339,9 +3353,10 @@ return /******/ (function(modules) { // webpackBootstrap
3339
3353
if ( ! this . vm . _isBeingDestroyed ) {
3340
3354
this . vm . _watchers . $remove ( this )
3341
3355
}
3342
- var i = this . deps . length
3356
+ var depIds = Object . keys ( this . deps )
3357
+ var i = depIds . length
3343
3358
while ( i -- ) {
3344
- this . deps [ i ] . removeSub ( this )
3359
+ this . deps [ depIds [ i ] ] . removeSub ( this )
3345
3360
}
3346
3361
this . active = false
3347
3362
this . vm = this . cb = this . value = null
@@ -3377,6 +3392,7 @@ return /******/ (function(modules) { // webpackBootstrap
3377
3392
/***/ function ( module , exports , __webpack_require__ ) {
3378
3393
3379
3394
var _ = __webpack_require__ ( 1 )
3395
+ var uid = 0
3380
3396
3381
3397
/**
3382
3398
* A dep is an observable that can have multiple
@@ -3386,6 +3402,7 @@ return /******/ (function(modules) { // webpackBootstrap
3386
3402
*/
3387
3403
3388
3404
function Dep ( ) {
3405
+ this . id = uid ++
3389
3406
this . subs = [ ]
3390
3407
}
3391
3408
@@ -4327,22 +4344,28 @@ return /******/ (function(modules) { // webpackBootstrap
4327
4344
4328
4345
// Test for the presence of the Safari template cloning bug
4329
4346
// https://bugs.webkit.org/show_bug.cgi?id=137755
4330
- var hasBrokenTemplate = _ . inBrowser
4331
- ? ( function ( ) {
4332
- var a = document . createElement ( 'div' )
4333
- a . innerHTML = '<template>1</template>'
4334
- return ! a . cloneNode ( true ) . firstChild . innerHTML
4335
- } ) ( )
4336
- : false
4347
+ var hasBrokenTemplate = ( function ( ) {
4348
+ /* istanbul ignore else */
4349
+ if ( _ . inBrowser ) {
4350
+ var a = document . createElement ( 'div' )
4351
+ a . innerHTML = '<template>1</template>'
4352
+ return ! a . cloneNode ( true ) . firstChild . innerHTML
4353
+ } else {
4354
+ return false
4355
+ }
4356
+ } ) ( )
4337
4357
4338
4358
// Test for IE10/11 textarea placeholder clone bug
4339
- var hasTextareaCloneBug = _ . inBrowser
4340
- ? ( function ( ) {
4341
- var t = document . createElement ( 'textarea' )
4342
- t . placeholder = 't'
4343
- return t . cloneNode ( true ) . value === 't'
4344
- } ) ( )
4345
- : false
4359
+ var hasTextareaCloneBug = ( function ( ) {
4360
+ /* istanbul ignore else */
4361
+ if ( _ . inBrowser ) {
4362
+ var t = document . createElement ( 'textarea' )
4363
+ t . placeholder = 't'
4364
+ return t . cloneNode ( true ) . value === 't'
4365
+ } else {
4366
+ return false
4367
+ }
4368
+ } ) ( )
4346
4369
4347
4370
/**
4348
4371
* 1. Deal with Safari cloning nested <template> bug by
@@ -7867,11 +7890,13 @@ return /******/ (function(modules) { // webpackBootstrap
7867
7890
return prev . concat ( cur )
7868
7891
} , [ ] )
7869
7892
return arr . filter ( function ( item ) {
7870
- return keys . length
7871
- ? keys . some ( function ( key ) {
7872
- return contains ( Path . get ( item , key ) , search )
7873
- } )
7874
- : contains ( item , search )
7893
+ if ( keys . length ) {
7894
+ return keys . some ( function ( key ) {
7895
+ return contains ( Path . get ( item , key ) , search )
7896
+ } )
7897
+ } else {
7898
+ return contains ( item , search )
7899
+ }
7875
7900
} )
7876
7901
}
7877
7902
@@ -7914,14 +7939,17 @@ return /******/ (function(modules) { // webpackBootstrap
7914
7939
*/
7915
7940
7916
7941
function contains ( val , search ) {
7942
+ var i
7917
7943
if ( _ . isPlainObject ( val ) ) {
7918
- for ( var key in val ) {
7919
- if ( contains ( val [ key ] , search ) ) {
7944
+ var keys = Object . keys ( val )
7945
+ i = keys . length
7946
+ while ( i -- ) {
7947
+ if ( contains ( val [ keys [ i ] ] , search ) ) {
7920
7948
return true
7921
7949
}
7922
7950
}
7923
7951
} else if ( _ . isArray ( val ) ) {
7924
- var i = val . length
7952
+ i = val . length
7925
7953
while ( i -- ) {
7926
7954
if ( contains ( val [ i ] , search ) ) {
7927
7955
return true
@@ -9108,6 +9136,7 @@ return /******/ (function(modules) { // webpackBootstrap
9108
9136
var Watcher = __webpack_require__ ( 17 )
9109
9137
var textParser = __webpack_require__ ( 13 )
9110
9138
var expParser = __webpack_require__ ( 19 )
9139
+ function noop ( ) { }
9111
9140
9112
9141
/**
9113
9142
* A directive links a DOM element with a piece of data,
@@ -9178,13 +9207,15 @@ return /******/ (function(modules) { // webpackBootstrap
9178
9207
! this . _checkStatement ( ) ) {
9179
9208
// wrapped updater for context
9180
9209
var dir = this
9181
- var update = this . _update = this . update
9182
- ? function ( val , oldVal ) {
9183
- if ( ! dir . _locked ) {
9184
- dir . update ( val , oldVal )
9185
- }
9210
+ if ( this . update ) {
9211
+ this . _update = function ( val , oldVal ) {
9212
+ if ( ! dir . _locked ) {
9213
+ dir . update ( val , oldVal )
9186
9214
}
9187
- : function ( ) { } // noop if no update is provided
9215
+ }
9216
+ } else {
9217
+ this . _update = noop
9218
+ }
9188
9219
// pre-process hook called before the value is piped
9189
9220
// through the filters. used in v-repeat.
9190
9221
var preProcess = this . _preProcess
@@ -9193,7 +9224,7 @@ return /******/ (function(modules) { // webpackBootstrap
9193
9224
var watcher = this . _watcher = new Watcher (
9194
9225
this . vm ,
9195
9226
this . _watcherExp ,
9196
- update , // callback
9227
+ this . _update , // callback
9197
9228
{
9198
9229
filters : this . filters ,
9199
9230
twoWay : this . twoWay ,
@@ -9523,7 +9554,7 @@ return /******/ (function(modules) { // webpackBootstrap
9523
9554
* Watch an expression, trigger callback when its
9524
9555
* value changes.
9525
9556
*
9526
- * @param {String } exp
9557
+ * @param {String|Function } expOrFn
9527
9558
* @param {Function } cb
9528
9559
* @param {Object } [options]
9529
9560
* - {Boolean} deep
@@ -9532,11 +9563,17 @@ return /******/ (function(modules) { // webpackBootstrap
9532
9563
* @return {Function } - unwatchFn
9533
9564
*/
9534
9565
9535
- exports . $watch = function ( exp , cb , options ) {
9566
+ exports . $watch = function ( expOrFn , cb , options ) {
9536
9567
var vm = this
9537
- var watcher = new Watcher ( vm , exp , cb , {
9568
+ var parsed
9569
+ if ( typeof expOrFn === 'string' ) {
9570
+ parsed = dirParser . parse ( expOrFn ) [ 0 ]
9571
+ expOrFn = parsed . expression
9572
+ }
9573
+ var watcher = new Watcher ( vm , expOrFn , cb , {
9538
9574
deep : options && options . deep ,
9539
- user : ! options || options . user !== false
9575
+ user : ! options || options . user !== false ,
9576
+ filters : parsed && parsed . filters
9540
9577
} )
9541
9578
if ( options && options . immediate ) {
9542
9579
cb . call ( vm , watcher . value )
@@ -9581,13 +9618,15 @@ return /******/ (function(modules) { // webpackBootstrap
9581
9618
var tokens = textParser . parse ( text )
9582
9619
var vm = this
9583
9620
if ( tokens ) {
9584
- return tokens . length === 1
9585
- ? vm . $eval ( tokens [ 0 ] . value )
9586
- : tokens . map ( function ( token ) {
9587
- return token . tag
9588
- ? vm . $eval ( token . value )
9589
- : token . value
9590
- } ) . join ( '' )
9621
+ if ( tokens . length === 1 ) {
9622
+ return vm . $eval ( tokens [ 0 ] . value ) + ''
9623
+ } else {
9624
+ return tokens . map ( function ( token ) {
9625
+ return token . tag
9626
+ ? vm . $eval ( token . value )
9627
+ : token . value
9628
+ } ) . join ( '' )
9629
+ }
9591
9630
} else {
9592
9631
return text
9593
9632
}
0 commit comments