11/*!
2- * Vue.js v0.12.15
2+ * Vue.js v0.12.16
33 * (c) 2015 Evan You
44 * Released under the MIT License.
55 */
@@ -1000,7 +1000,7 @@ return /******/ (function(modules) { // webpackBootstrap
10001000 * @param {Vue } [vm]
10011001 */
10021002
1003- var strats = Object . create ( null )
1003+ var strats = config . optionMergeStrategies = Object . create ( null )
10041004
10051005 /**
10061006 * Helper that recursively merges two data objects together.
@@ -1642,6 +1642,16 @@ return /******/ (function(modules) { // webpackBootstrap
16421642 return this
16431643 }
16441644
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+
16451655 /**
16461656 * Create asset registration methods with the following
16471657 * signature:
@@ -2276,22 +2286,26 @@ return /******/ (function(modules) { // webpackBootstrap
22762286 allOneTime = false
22772287 }
22782288 }
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+ }
22792306 return {
22802307 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
22952309 }
22962310 }
22972311 }
@@ -2623,11 +2637,13 @@ return /******/ (function(modules) { // webpackBootstrap
26232637 */
26242638
26252639 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+ }
26312647 }
26322648
26332649 /**
@@ -3096,7 +3112,7 @@ return /******/ (function(modules) { // webpackBootstrap
30963112 this . id = ++ uid // uid for batching
30973113 this . active = true
30983114 this . dirty = this . lazy // for lazy watchers
3099- this . deps = [ ]
3115+ this . deps = Object . create ( null )
31003116 this . newDeps = null
31013117 this . prevError = null // for async error stacks
31023118 // parse expression for getter/setter
@@ -3123,15 +3139,12 @@ return /******/ (function(modules) { // webpackBootstrap
31233139 */
31243140
31253141 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
31323147 dep . addSub ( this )
3133- } else {
3134- old [ i ] = null
31353148 }
31363149 }
31373150 }
@@ -3209,7 +3222,7 @@ return /******/ (function(modules) { // webpackBootstrap
32093222
32103223 Watcher . prototype . beforeGet = function ( ) {
32113224 Dep . target = this
3212- this . newDeps = [ ]
3225+ this . newDeps = Object . create ( null )
32133226 }
32143227
32153228 /**
@@ -3218,15 +3231,15 @@ return /******/ (function(modules) { // webpackBootstrap
32183231
32193232 Watcher . prototype . afterGet = function ( ) {
32203233 Dep . target = null
3221- var i = this . deps . length
3234+ var ids = Object . keys ( this . deps )
3235+ var i = ids . length
32223236 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 )
32263240 }
32273241 }
32283242 this . deps = this . newDeps
3229- this . newDeps = null
32303243 }
32313244
32323245 /**
@@ -3321,9 +3334,10 @@ return /******/ (function(modules) { // webpackBootstrap
33213334 */
33223335
33233336 Watcher . prototype . depend = function ( ) {
3324- var i = this . deps . length
3337+ var depIds = Object . keys ( this . deps )
3338+ var i = depIds . length
33253339 while ( i -- ) {
3326- this . deps [ i ] . depend ( )
3340+ this . deps [ depIds [ i ] ] . depend ( )
33273341 }
33283342 }
33293343
@@ -3339,9 +3353,10 @@ return /******/ (function(modules) { // webpackBootstrap
33393353 if ( ! this . vm . _isBeingDestroyed ) {
33403354 this . vm . _watchers . $remove ( this )
33413355 }
3342- var i = this . deps . length
3356+ var depIds = Object . keys ( this . deps )
3357+ var i = depIds . length
33433358 while ( i -- ) {
3344- this . deps [ i ] . removeSub ( this )
3359+ this . deps [ depIds [ i ] ] . removeSub ( this )
33453360 }
33463361 this . active = false
33473362 this . vm = this . cb = this . value = null
@@ -3377,6 +3392,7 @@ return /******/ (function(modules) { // webpackBootstrap
33773392/***/ function ( module , exports , __webpack_require__ ) {
33783393
33793394 var _ = __webpack_require__ ( 1 )
3395+ var uid = 0
33803396
33813397 /**
33823398 * A dep is an observable that can have multiple
@@ -3386,6 +3402,7 @@ return /******/ (function(modules) { // webpackBootstrap
33863402 */
33873403
33883404 function Dep ( ) {
3405+ this . id = uid ++
33893406 this . subs = [ ]
33903407 }
33913408
@@ -4327,22 +4344,28 @@ return /******/ (function(modules) { // webpackBootstrap
43274344
43284345 // Test for the presence of the Safari template cloning bug
43294346 // 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+ } ) ( )
43374357
43384358 // 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+ } ) ( )
43464369
43474370 /**
43484371 * 1. Deal with Safari cloning nested <template> bug by
@@ -7867,11 +7890,13 @@ return /******/ (function(modules) { // webpackBootstrap
78677890 return prev . concat ( cur )
78687891 } , [ ] )
78697892 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+ }
78757900 } )
78767901 }
78777902
@@ -7914,14 +7939,17 @@ return /******/ (function(modules) { // webpackBootstrap
79147939 */
79157940
79167941 function contains ( val , search ) {
7942+ var i
79177943 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 ) ) {
79207948 return true
79217949 }
79227950 }
79237951 } else if ( _ . isArray ( val ) ) {
7924- var i = val . length
7952+ i = val . length
79257953 while ( i -- ) {
79267954 if ( contains ( val [ i ] , search ) ) {
79277955 return true
@@ -9108,6 +9136,7 @@ return /******/ (function(modules) { // webpackBootstrap
91089136 var Watcher = __webpack_require__ ( 17 )
91099137 var textParser = __webpack_require__ ( 13 )
91109138 var expParser = __webpack_require__ ( 19 )
9139+ function noop ( ) { }
91119140
91129141 /**
91139142 * A directive links a DOM element with a piece of data,
@@ -9178,13 +9207,15 @@ return /******/ (function(modules) { // webpackBootstrap
91789207 ! this . _checkStatement ( ) ) {
91799208 // wrapped updater for context
91809209 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 )
91869214 }
9187- : function ( ) { } // noop if no update is provided
9215+ }
9216+ } else {
9217+ this . _update = noop
9218+ }
91889219 // pre-process hook called before the value is piped
91899220 // through the filters. used in v-repeat.
91909221 var preProcess = this . _preProcess
@@ -9193,7 +9224,7 @@ return /******/ (function(modules) { // webpackBootstrap
91939224 var watcher = this . _watcher = new Watcher (
91949225 this . vm ,
91959226 this . _watcherExp ,
9196- update , // callback
9227+ this . _update , // callback
91979228 {
91989229 filters : this . filters ,
91999230 twoWay : this . twoWay ,
@@ -9523,7 +9554,7 @@ return /******/ (function(modules) { // webpackBootstrap
95239554 * Watch an expression, trigger callback when its
95249555 * value changes.
95259556 *
9526- * @param {String } exp
9557+ * @param {String|Function } expOrFn
95279558 * @param {Function } cb
95289559 * @param {Object } [options]
95299560 * - {Boolean} deep
@@ -9532,11 +9563,17 @@ return /******/ (function(modules) { // webpackBootstrap
95329563 * @return {Function } - unwatchFn
95339564 */
95349565
9535- exports . $watch = function ( exp , cb , options ) {
9566+ exports . $watch = function ( expOrFn , cb , options ) {
95369567 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 , {
95389574 deep : options && options . deep ,
9539- user : ! options || options . user !== false
9575+ user : ! options || options . user !== false ,
9576+ filters : parsed && parsed . filters
95409577 } )
95419578 if ( options && options . immediate ) {
95429579 cb . call ( vm , watcher . value )
@@ -9581,13 +9618,15 @@ return /******/ (function(modules) { // webpackBootstrap
95819618 var tokens = textParser . parse ( text )
95829619 var vm = this
95839620 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+ }
95919630 } else {
95929631 return text
95939632 }
0 commit comments