1
1
/*!
2
- * Vue.js v2.2.1
2
+ * Vue.js v2.2.2
3
3
* (c) 2014-2017 Evan You
4
4
* Released under the MIT License.
5
5
*/
@@ -214,7 +214,12 @@ function looseEqual (a, b) {
214
214
var isObjectA = isObject ( a ) ;
215
215
var isObjectB = isObject ( b ) ;
216
216
if ( isObjectA && isObjectB ) {
217
- return JSON . stringify ( a ) === JSON . stringify ( b )
217
+ try {
218
+ return JSON . stringify ( a ) === JSON . stringify ( b )
219
+ } catch ( e ) {
220
+ // possible circular reference
221
+ return a === b
222
+ }
218
223
} else if ( ! isObjectA && ! isObjectB ) {
219
224
return String ( a ) === String ( b )
220
225
} else {
@@ -533,15 +538,14 @@ var bailRE = /[^\w.$]/;
533
538
function parsePath ( path ) {
534
539
if ( bailRE . test ( path ) ) {
535
540
return
536
- } else {
537
- var segments = path . split ( '.' ) ;
538
- return function ( obj ) {
539
- for ( var i = 0 ; i < segments . length ; i ++ ) {
540
- if ( ! obj ) { return }
541
- obj = obj [ segments [ i ] ] ;
542
- }
543
- return obj
541
+ }
542
+ var segments = path . split ( '.' ) ;
543
+ return function ( obj ) {
544
+ for ( var i = 0 ; i < segments . length ; i ++ ) {
545
+ if ( ! obj ) { return }
546
+ obj = obj [ segments [ i ] ] ;
544
547
}
548
+ return obj
545
549
}
546
550
}
547
551
@@ -629,7 +633,7 @@ Dep.prototype.depend = function depend () {
629
633
} ;
630
634
631
635
Dep . prototype . notify = function notify ( ) {
632
- // stablize the subscriber list first
636
+ // stabilize the subscriber list first
633
637
var subs = this . subs . slice ( ) ;
634
638
for ( var i = 0 , l = subs . length ; i < l ; i ++ ) {
635
639
subs [ i ] . update ( ) ;
@@ -872,27 +876,27 @@ function defineReactive$$1 (
872
876
* triggers change notification if the property doesn't
873
877
* already exist.
874
878
*/
875
- function set ( obj , key , val ) {
876
- if ( Array . isArray ( obj ) ) {
877
- obj . length = Math . max ( obj . length , key ) ;
878
- obj . splice ( key , 1 , val ) ;
879
+ function set ( target , key , val ) {
880
+ if ( Array . isArray ( target ) ) {
881
+ target . length = Math . max ( target . length , key ) ;
882
+ target . splice ( key , 1 , val ) ;
879
883
return val
880
884
}
881
- if ( hasOwn ( obj , key ) ) {
882
- obj [ key ] = val ;
883
- return
885
+ if ( hasOwn ( target , key ) ) {
886
+ target [ key ] = val ;
887
+ return val
884
888
}
885
- var ob = obj . __ob__ ;
886
- if ( obj . _isVue || ( ob && ob . vmCount ) ) {
889
+ var ob = target . __ob__ ;
890
+ if ( target . _isVue || ( ob && ob . vmCount ) ) {
887
891
process . env . NODE_ENV !== 'production' && warn (
888
892
'Avoid adding reactive properties to a Vue instance or its root $data ' +
889
893
'at runtime - declare it upfront in the data option.'
890
894
) ;
891
- return
895
+ return val
892
896
}
893
897
if ( ! ob ) {
894
- obj [ key ] = val ;
895
- return
898
+ target [ key ] = val ;
899
+ return val
896
900
}
897
901
defineReactive$$1 ( ob . value , key , val ) ;
898
902
ob . dep . notify ( ) ;
@@ -902,23 +906,23 @@ function set (obj, key, val) {
902
906
/**
903
907
* Delete a property and trigger change if necessary.
904
908
*/
905
- function del ( obj , key ) {
906
- if ( Array . isArray ( obj ) ) {
907
- obj . splice ( key , 1 ) ;
909
+ function del ( target , key ) {
910
+ if ( Array . isArray ( target ) ) {
911
+ target . splice ( key , 1 ) ;
908
912
return
909
913
}
910
- var ob = obj . __ob__ ;
911
- if ( obj . _isVue || ( ob && ob . vmCount ) ) {
914
+ var ob = target . __ob__ ;
915
+ if ( target . _isVue || ( ob && ob . vmCount ) ) {
912
916
process . env . NODE_ENV !== 'production' && warn (
913
917
'Avoid deleting properties on a Vue instance or its root $data ' +
914
918
'- just set it to null.'
915
919
) ;
916
920
return
917
921
}
918
- if ( ! hasOwn ( obj , key ) ) {
922
+ if ( ! hasOwn ( target , key ) ) {
919
923
return
920
924
}
921
- delete obj [ key ] ;
925
+ delete target [ key ] ;
922
926
if ( ! ob ) {
923
927
return
924
928
}
@@ -1434,12 +1438,12 @@ function isType (type, fn) {
1434
1438
return false
1435
1439
}
1436
1440
1437
- function handleError ( err , vm , type ) {
1441
+ function handleError ( err , vm , info ) {
1438
1442
if ( config . errorHandler ) {
1439
- config . errorHandler . call ( null , err , vm , type ) ;
1443
+ config . errorHandler . call ( null , err , vm , info ) ;
1440
1444
} else {
1441
1445
if ( process . env . NODE_ENV !== 'production' ) {
1442
- warn ( ( "Error in " + type + ":" ) , vm ) ;
1446
+ warn ( ( "Error in " + info + ":" ) , vm ) ;
1443
1447
}
1444
1448
/* istanbul ignore else */
1445
1449
if ( inBrowser && typeof console !== 'undefined' ) {
@@ -1598,8 +1602,9 @@ function cloneVNode (vnode) {
1598
1602
}
1599
1603
1600
1604
function cloneVNodes ( vnodes ) {
1601
- var res = new Array ( vnodes . length ) ;
1602
- for ( var i = 0 ; i < vnodes . length ; i ++ ) {
1605
+ var len = vnodes . length ;
1606
+ var res = new Array ( len ) ;
1607
+ for ( var i = 0 ; i < len ; i ++ ) {
1603
1608
res [ i ] = cloneVNode ( vnodes [ i ] ) ;
1604
1609
}
1605
1610
return res
@@ -1727,7 +1732,7 @@ function simpleNormalizeChildren (children) {
1727
1732
return children
1728
1733
}
1729
1734
1730
- // 2. When the children contains constrcuts that always generated nested Arrays,
1735
+ // 2. When the children contains constructs that always generated nested Arrays,
1731
1736
// e.g. <template>, <slot>, v-for, or when the children is provided by user
1732
1737
// with hand-written render functions / JSX. In such cases a full normalization
1733
1738
// is needed to cater to all possible types of children values.
@@ -1845,12 +1850,21 @@ function eventsMixin (Vue) {
1845
1850
} ;
1846
1851
1847
1852
Vue . prototype . $off = function ( event , fn ) {
1853
+ var this$1 = this ;
1854
+
1848
1855
var vm = this ;
1849
1856
// all
1850
1857
if ( ! arguments . length ) {
1851
1858
vm . _events = Object . create ( null ) ;
1852
1859
return vm
1853
1860
}
1861
+ // array of events
1862
+ if ( Array . isArray ( event ) ) {
1863
+ for ( var i$1 = 0 , l = event . length ; i$1 < l ; i$1 ++ ) {
1864
+ this$1 . $off ( event [ i$1 ] , fn ) ;
1865
+ }
1866
+ return vm
1867
+ }
1854
1868
// specific event
1855
1869
var cbs = vm . _events [ event ] ;
1856
1870
if ( ! cbs ) {
@@ -1918,16 +1932,17 @@ function resolveSlots (
1918
1932
defaultSlot . push ( child ) ;
1919
1933
}
1920
1934
}
1921
- // ignore single whitespace
1922
- if ( defaultSlot . length && ! (
1923
- defaultSlot . length === 1 &&
1924
- ( defaultSlot [ 0 ] . text === ' ' || defaultSlot [ 0 ] . isComment )
1925
- ) ) {
1935
+ // ignore whitespace
1936
+ if ( ! defaultSlot . every ( isWhitespace ) ) {
1926
1937
slots . default = defaultSlot ;
1927
1938
}
1928
1939
return slots
1929
1940
}
1930
1941
1942
+ function isWhitespace ( node ) {
1943
+ return node . isComment || node . text === ' '
1944
+ }
1945
+
1931
1946
function resolveScopedSlots (
1932
1947
fns
1933
1948
) {
@@ -2064,10 +2079,11 @@ function mountComponent (
2064
2079
vm . $options . render = createEmptyVNode ;
2065
2080
if ( process . env . NODE_ENV !== 'production' ) {
2066
2081
/* istanbul ignore if */
2067
- if ( vm . $options . template && vm . $options . template . charAt ( 0 ) !== '#' ) {
2082
+ if ( ( vm . $options . template && vm . $options . template . charAt ( 0 ) !== '#' ) ||
2083
+ vm . $options . el || el ) {
2068
2084
warn (
2069
2085
'You are using the runtime-only build of Vue where the template ' +
2070
- 'option is not available. Either pre-compile the templates into ' +
2086
+ 'compiler is not available. Either pre-compile the templates into ' +
2071
2087
'render functions, or use the compiler-included build.' ,
2072
2088
vm
2073
2089
) ;
@@ -3563,14 +3579,17 @@ function renderMixin (Vue) {
3563
3579
3564
3580
/* */
3565
3581
3566
- function initInjections ( vm ) {
3582
+ function initProvide ( vm ) {
3567
3583
var provide = vm . $options . provide ;
3568
- var inject = vm . $options . inject ;
3569
3584
if ( provide ) {
3570
3585
vm . _provided = typeof provide === 'function'
3571
3586
? provide . call ( vm )
3572
3587
: provide ;
3573
3588
}
3589
+ }
3590
+
3591
+ function initInjections ( vm ) {
3592
+ var inject = vm . $options . inject ;
3574
3593
if ( inject ) {
3575
3594
// inject is :any because flow is not smart enough to figure out cached
3576
3595
// isArray here
@@ -3586,7 +3605,7 @@ function initInjections (vm) {
3586
3605
var provideKey = isArray ? key : inject [ key ] ;
3587
3606
var source = vm ;
3588
3607
while ( source ) {
3589
- if ( source . _provided && source . _provided [ provideKey ] ) {
3608
+ if ( source . _provided && provideKey in source . _provided ) {
3590
3609
vm [ key ] = source . _provided [ provideKey ] ;
3591
3610
break
3592
3611
}
@@ -3637,8 +3656,9 @@ function initMixin (Vue) {
3637
3656
initEvents ( vm ) ;
3638
3657
initRender ( vm ) ;
3639
3658
callHook ( vm , 'beforeCreate' ) ;
3659
+ initInjections ( vm ) ; // resolve injections before data/props
3640
3660
initState ( vm ) ;
3641
- initInjections ( vm ) ;
3661
+ initProvide ( vm ) ; // resolve provide after data/props
3642
3662
callHook ( vm , 'created' ) ;
3643
3663
3644
3664
/* istanbul ignore if */
@@ -4057,7 +4077,7 @@ Object.defineProperty(Vue$2.prototype, '$isServer', {
4057
4077
get : isServerRendering
4058
4078
} ) ;
4059
4079
4060
- Vue$2 . version = '2.2.1 ' ;
4080
+ Vue$2 . version = '2.2.2 ' ;
4061
4081
4062
4082
/* */
4063
4083
@@ -5724,9 +5744,9 @@ var transformRE = /\b(transform|all)(,|$)/;
5724
5744
5725
5745
function getTransitionInfo ( el , expectedType ) {
5726
5746
var styles = window . getComputedStyle ( el ) ;
5727
- var transitioneDelays = styles [ transitionProp + 'Delay' ] . split ( ', ' ) ;
5747
+ var transitionDelays = styles [ transitionProp + 'Delay' ] . split ( ', ' ) ;
5728
5748
var transitionDurations = styles [ transitionProp + 'Duration' ] . split ( ', ' ) ;
5729
- var transitionTimeout = getTimeout ( transitioneDelays , transitionDurations ) ;
5749
+ var transitionTimeout = getTimeout ( transitionDelays , transitionDurations ) ;
5730
5750
var animationDelays = styles [ animationProp + 'Delay' ] . split ( ', ' ) ;
5731
5751
var animationDurations = styles [ animationProp + 'Duration' ] . split ( ', ' ) ;
5732
5752
var animationTimeout = getTimeout ( animationDelays , animationDurations ) ;
@@ -5876,7 +5896,7 @@ function enter (vnode, toggleDisplay) {
5876
5896
}
5877
5897
5878
5898
var expectsCSS = css !== false && ! isIE9 ;
5879
- var userWantsControl = getHookAgumentsLength ( enterHook ) ;
5899
+ var userWantsControl = getHookArgumentsLength ( enterHook ) ;
5880
5900
5881
5901
var cb = el . _enterCb = once ( function ( ) {
5882
5902
if ( expectsCSS ) {
@@ -5968,7 +5988,7 @@ function leave (vnode, rm) {
5968
5988
var duration = data . duration ;
5969
5989
5970
5990
var expectsCSS = css !== false && ! isIE9 ;
5971
- var userWantsControl = getHookAgumentsLength ( leave ) ;
5991
+ var userWantsControl = getHookArgumentsLength ( leave ) ;
5972
5992
5973
5993
var explicitLeaveDuration = toNumber (
5974
5994
isObject ( duration )
@@ -6065,12 +6085,12 @@ function isValidDuration (val) {
6065
6085
* - a wrapped component method (check ._length)
6066
6086
* - a plain function (.length)
6067
6087
*/
6068
- function getHookAgumentsLength ( fn ) {
6088
+ function getHookArgumentsLength ( fn ) {
6069
6089
if ( ! fn ) { return false }
6070
6090
var invokerFns = fn . fns ;
6071
6091
if ( invokerFns ) {
6072
6092
// invoker
6073
- return getHookAgumentsLength (
6093
+ return getHookArgumentsLength (
6074
6094
Array . isArray ( invokerFns )
6075
6095
? invokerFns [ 0 ]
6076
6096
: invokerFns
@@ -6490,7 +6510,7 @@ var Transition = {
6490
6510
// we force transition-group to update its children into two passes:
6491
6511
// in the first pass, we remove all nodes that need to be removed,
6492
6512
// triggering their leaving transition; in the second pass, we insert/move
6493
- // into the final disired state. This way in the second pass removed
6513
+ // into the final desired state. This way in the second pass removed
6494
6514
// nodes will remain where they should be.
6495
6515
6496
6516
var props = extend ( {
0 commit comments