1
1
/*!
2
- * Vue.js v1.0.24
2
+ * Vue.js v1.0.25
3
3
* (c) 2016 Evan You
4
4
* Released under the MIT License.
5
5
*/
@@ -398,10 +398,15 @@ var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
398
398
399
399
// UA sniffing for working around browser-specific quirks
400
400
var UA = inBrowser && window . navigator . userAgent . toLowerCase ( ) ;
401
+ var isIE = UA && UA . indexOf ( 'trident' ) > 0 ;
401
402
var isIE9 = UA && UA . indexOf ( 'msie 9.0' ) > 0 ;
402
403
var isAndroid = UA && UA . indexOf ( 'android' ) > 0 ;
403
404
var isIos = UA && / ( i p h o n e | i p a d | i p o d | i o s ) / i. test ( UA ) ;
404
- var isWechat = UA && UA . indexOf ( 'micromessenger' ) > 0 ;
405
+ var iosVersionMatch = isIos && UA . match ( / o s ( [ \d _ ] + ) / ) ;
406
+ var iosVersion = iosVersionMatch && iosVersionMatch [ 1 ] . split ( '_' ) ;
407
+
408
+ // detecting iOS UIWebView by indexedDB
409
+ var hasMutationObserverBug = iosVersion && Number ( iosVersion [ 0 ] ) >= 9 && Number ( iosVersion [ 1 ] ) >= 3 && ! window . indexedDB ;
405
410
406
411
var transitionProp = undefined ;
407
412
var transitionEndEvent = undefined ;
@@ -442,7 +447,7 @@ var nextTick = (function () {
442
447
}
443
448
444
449
/* istanbul ignore if */
445
- if ( typeof MutationObserver !== 'undefined' && ! ( isWechat && isIos ) ) {
450
+ if ( typeof MutationObserver !== 'undefined' && ! hasMutationObserverBug ) {
446
451
var counter = 1 ;
447
452
var observer = new MutationObserver ( nextTickHandler ) ;
448
453
var textNode = document . createTextNode ( counter ) ;
@@ -514,12 +519,12 @@ var p = Cache.prototype;
514
519
515
520
p . put = function ( key , value ) {
516
521
var removed ;
517
- if ( this . size === this . limit ) {
518
- removed = this . shift ( ) ;
519
- }
520
522
521
523
var entry = this . get ( key , true ) ;
522
524
if ( ! entry ) {
525
+ if ( this . size === this . limit ) {
526
+ removed = this . shift ( ) ;
527
+ }
523
528
entry = {
524
529
key : key
525
530
} ;
@@ -764,7 +769,7 @@ function compileRegex() {
764
769
var unsafeOpen = escapeRegex ( config . unsafeDelimiters [ 0 ] ) ;
765
770
var unsafeClose = escapeRegex ( config . unsafeDelimiters [ 1 ] ) ;
766
771
tagRE = new RegExp ( unsafeOpen + '((?:.|\\n)+?)' + unsafeClose + '|' + open + '((?:.|\\n)+?)' + close , 'g' ) ;
767
- htmlRE = new RegExp ( '^' + unsafeOpen + '.* ' + unsafeClose + '$' ) ;
772
+ htmlRE = new RegExp ( '^' + unsafeOpen + '((?:.|\\n)+?) ' + unsafeClose + '$' ) ;
768
773
// reset cache
769
774
cache = new Cache ( 1000 ) ;
770
775
}
@@ -1551,7 +1556,8 @@ if (process.env.NODE_ENV !== 'production') {
1551
1556
return ( / H T M L U n k n o w n E l e m e n t / . test ( el . toString ( ) ) &&
1552
1557
// Chrome returns unknown for several HTML5 elements.
1553
1558
// https://code.google.com/p/chromium/issues/detail?id=540526
1554
- ! / ^ ( d a t a | t i m e | r t c | r b ) $ / . test ( tag )
1559
+ // Firefox returns unknown for some "Interactive elements."
1560
+ ! / ^ ( d a t a | t i m e | r t c | r b | d e t a i l s | d i a l o g | s u m m a r y ) $ / . test ( tag )
1555
1561
) ;
1556
1562
}
1557
1563
} ;
@@ -1887,7 +1893,9 @@ function mergeOptions(parent, child, vm) {
1887
1893
}
1888
1894
if ( child . mixins ) {
1889
1895
for ( var i = 0 , l = child . mixins . length ; i < l ; i ++ ) {
1890
- parent = mergeOptions ( parent , child . mixins [ i ] , vm ) ;
1896
+ var mixin = child . mixins [ i ] ;
1897
+ var mixinOptions = mixin . prototype instanceof Vue ? mixin . options : mixin ;
1898
+ parent = mergeOptions ( parent , mixinOptions , vm ) ;
1891
1899
}
1892
1900
}
1893
1901
for ( key in parent ) {
@@ -2315,10 +2323,13 @@ var util = Object.freeze({
2315
2323
hasProto : hasProto ,
2316
2324
inBrowser : inBrowser ,
2317
2325
devtools : devtools ,
2326
+ isIE : isIE ,
2318
2327
isIE9 : isIE9 ,
2319
2328
isAndroid : isAndroid ,
2320
2329
isIos : isIos ,
2321
- isWechat : isWechat ,
2330
+ iosVersionMatch : iosVersionMatch ,
2331
+ iosVersion : iosVersion ,
2332
+ hasMutationObserverBug : hasMutationObserverBug ,
2322
2333
get transitionProp ( ) { return transitionProp ; } ,
2323
2334
get transitionEndEvent ( ) { return transitionEndEvent ; } ,
2324
2335
get animationProp ( ) { return animationProp ; } ,
@@ -2806,7 +2817,9 @@ var saveRE = /[\{,]\s*[\w\$_]+\s*:|('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\
2806
2817
var restoreRE = / " ( \d + ) " / g;
2807
2818
var pathTestRE = / ^ [ A - Z a - z _ $ ] [ \w $ ] * (?: \. [ A - Z a - z _ $ ] [ \w $ ] * | \[ ' .* ?' \] | \[ " .* ?" \] | \[ \d + \] | \[ [ A - Z a - z _ $ ] [ \w $ ] * \] ) * $ / ;
2808
2819
var identRE = / [ ^ \w $ \. ] (?: [ A - Z a - z _ $ ] [ \w $ ] * ) / g;
2809
- var booleanLiteralRE = / ^ (?: t r u e | f a l s e ) $ / ;
2820
+ var literalValueRE$1 = / ^ (?: t r u e | f a l s e | n u l l | u n d e f i n e d | I n f i n i t y | N a N ) $ / ;
2821
+
2822
+ function noop ( ) { }
2810
2823
2811
2824
/**
2812
2825
* Save / Rewrite / Restore
@@ -2888,7 +2901,7 @@ function compileGetter(exp) {
2888
2901
// save strings and object literal keys
2889
2902
var body = exp . replace ( saveRE , save ) . replace ( wsRE , '' ) ;
2890
2903
// rewrite all paths
2891
- // pad 1 space here becaue the regex matches 1 extra char
2904
+ // pad 1 space here because the regex matches 1 extra char
2892
2905
body = ( ' ' + body ) . replace ( identRE , rewrite ) . replace ( restoreRE , restore ) ;
2893
2906
return makeGetterFn ( body ) ;
2894
2907
}
@@ -2909,7 +2922,15 @@ function makeGetterFn(body) {
2909
2922
return new Function ( 'scope' , 'return ' + body + ';' ) ;
2910
2923
/* eslint-enable no-new-func */
2911
2924
} catch ( e ) {
2912
- process . env . NODE_ENV !== 'production' && warn ( 'Invalid expression. ' + 'Generated function body: ' + body ) ;
2925
+ if ( process . env . NODE_ENV !== 'production' ) {
2926
+ /* istanbul ignore if */
2927
+ if ( e . toString ( ) . match ( / u n s a f e - e v a l | C S P / ) ) {
2928
+ warn ( 'It seems you are using the default build of Vue.js in an environment ' + 'with Content Security Policy that prohibits unsafe-eval. ' + 'Use the CSP-compliant build instead: ' + 'http://vuejs.org/guide/installation.html#CSP-compliant-build' ) ;
2929
+ } else {
2930
+ warn ( 'Invalid expression. ' + 'Generated function body: ' + body ) ;
2931
+ }
2932
+ }
2933
+ return noop ;
2913
2934
}
2914
2935
}
2915
2936
@@ -2971,8 +2992,8 @@ function parseExpression(exp, needSet) {
2971
2992
2972
2993
function isSimplePath ( exp ) {
2973
2994
return pathTestRE . test ( exp ) &&
2974
- // don't treat true/false as paths
2975
- ! booleanLiteralRE . test ( exp ) &&
2995
+ // don't treat literal values as paths
2996
+ ! literalValueRE$1 . test ( exp ) &&
2976
2997
// Math constants e.g. Math.PI, Math.E etc.
2977
2998
exp . slice ( 0 , 5 ) !== 'Math.' ;
2978
2999
}
@@ -3451,6 +3472,7 @@ function isRealTemplate(node) {
3451
3472
3452
3473
var tagRE$1 = / < ( [ \w : - ] + ) / ;
3453
3474
var entityRE = / & # ? \w + ?; / ;
3475
+ var commentRE = / < ! - - / ;
3454
3476
3455
3477
/**
3456
3478
* Convert a string template to a DocumentFragment.
@@ -3473,8 +3495,9 @@ function stringToFragment(templateString, raw) {
3473
3495
var frag = document . createDocumentFragment ( ) ;
3474
3496
var tagMatch = templateString . match ( tagRE$1 ) ;
3475
3497
var entityMatch = entityRE . test ( templateString ) ;
3498
+ var commentMatch = commentRE . test ( templateString ) ;
3476
3499
3477
- if ( ! tagMatch && ! entityMatch ) {
3500
+ if ( ! tagMatch && ! entityMatch && ! commentMatch ) {
3478
3501
// text only, return a single text node.
3479
3502
frag . appendChild ( document . createTextNode ( templateString ) ) ;
3480
3503
} else {
@@ -4441,7 +4464,7 @@ var vFor = {
4441
4464
* the filters. This is passed to and called by the watcher.
4442
4465
*
4443
4466
* It is necessary for this to be called during the
4444
- * wathcer 's dependency collection phase because we want
4467
+ * watcher 's dependency collection phase because we want
4445
4468
* the v-for to update when the source Object is mutated.
4446
4469
*/
4447
4470
@@ -4784,7 +4807,10 @@ var text$2 = {
4784
4807
} ,
4785
4808
4786
4809
update : function update ( value ) {
4787
- this . el . value = _toString ( value ) ;
4810
+ // #3029 only update when the value changes. This prevent
4811
+ // browsers from overwriting values like selectionStart
4812
+ value = _toString ( value ) ;
4813
+ if ( value !== this . el . value ) this . el . value = value ;
4788
4814
} ,
4789
4815
4790
4816
unbind : function unbind ( ) {
@@ -4833,6 +4859,8 @@ var radio = {
4833
4859
var select = {
4834
4860
4835
4861
bind : function bind ( ) {
4862
+ var _this = this ;
4863
+
4836
4864
var self = this ;
4837
4865
var el = this . el ;
4838
4866
@@ -4864,11 +4892,16 @@ var select = {
4864
4892
// selectedIndex with value -1 to 0 when the element
4865
4893
// is appended to a new parent, therefore we have to
4866
4894
// force a DOM update whenever that happens...
4867
- this . vm . $on ( 'hook:attached' , this . forceUpdate ) ;
4895
+ this . vm . $on ( 'hook:attached' , function ( ) {
4896
+ nextTick ( _this . forceUpdate ) ;
4897
+ } ) ;
4868
4898
} ,
4869
4899
4870
4900
update : function update ( value ) {
4871
4901
var el = this . el ;
4902
+ if ( ! inDoc ( el ) ) {
4903
+ return nextTick ( this . forceUpdate ) ;
4904
+ }
4872
4905
el . selectedIndex = - 1 ;
4873
4906
var multi = this . multiple && isArray ( value ) ;
4874
4907
var options = el . options ;
@@ -6134,7 +6167,7 @@ function processPropValue(vm, prop, rawValue, fn) {
6134
6167
if ( value === undefined ) {
6135
6168
value = getPropDefaultValue ( vm , prop ) ;
6136
6169
}
6137
- value = coerceProp ( prop , value ) ;
6170
+ value = coerceProp ( prop , value , vm ) ;
6138
6171
var coerced = value !== rawValue ;
6139
6172
if ( ! assertProp ( prop , value , vm ) ) {
6140
6173
value = undefined ;
@@ -6253,13 +6286,17 @@ function assertProp(prop, value, vm) {
6253
6286
* @return {* }
6254
6287
*/
6255
6288
6256
- function coerceProp ( prop , value ) {
6289
+ function coerceProp ( prop , value , vm ) {
6257
6290
var coerce = prop . options . coerce ;
6258
6291
if ( ! coerce ) {
6259
6292
return value ;
6260
6293
}
6261
- // coerce is a function
6262
- return coerce ( value ) ;
6294
+ if ( typeof coerce === 'function' ) {
6295
+ return coerce ( value ) ;
6296
+ } else {
6297
+ process . env . NODE_ENV !== 'production' && warn ( 'Invalid coerce for prop "' + prop . name + '": expected function, got ' + typeof coerce + '.' , vm ) ;
6298
+ return value ;
6299
+ }
6263
6300
}
6264
6301
6265
6302
/**
@@ -6791,10 +6828,9 @@ var transition$1 = {
6791
6828
// resolve on owner vm
6792
6829
var hooks = resolveAsset ( this . vm . $options , 'transitions' , id ) ;
6793
6830
id = id || 'v' ;
6831
+ oldId = oldId || 'v' ;
6794
6832
el . __v_trans = new Transition ( el , id , hooks , this . vm ) ;
6795
- if ( oldId ) {
6796
- removeClass ( el , oldId + '-transition' ) ;
6797
- }
6833
+ removeClass ( el , oldId + '-transition' ) ;
6798
6834
addClass ( el , id + '-transition' ) ;
6799
6835
}
6800
6836
} ;
@@ -7219,7 +7255,7 @@ function makeTextNodeLinkFn(tokens, frag) {
7219
7255
if ( token . html ) {
7220
7256
replace ( node , parseTemplate ( value , true ) ) ;
7221
7257
} else {
7222
- node . data = value ;
7258
+ node . data = _toString ( value ) ;
7223
7259
}
7224
7260
} else {
7225
7261
vm . _bindDir ( token . descriptor , node , host , scope ) ;
@@ -8203,7 +8239,7 @@ function eventsMixin (Vue) {
8203
8239
} ;
8204
8240
}
8205
8241
8206
- function noop ( ) { }
8242
+ function noop$1 ( ) { }
8207
8243
8208
8244
/**
8209
8245
* A directive links a DOM element with a piece of data,
@@ -8302,7 +8338,7 @@ Directive.prototype._bind = function () {
8302
8338
}
8303
8339
} ;
8304
8340
} else {
8305
- this . _update = noop ;
8341
+ this . _update = noop$1 ;
8306
8342
}
8307
8343
var preProcess = this . _preProcess ? bind ( this . _preProcess , this ) : null ;
8308
8344
var postProcess = this . _postProcess ? bind ( this . _postProcess , this ) : null ;
@@ -9740,7 +9776,7 @@ var filters = {
9740
9776
9741
9777
json : {
9742
9778
read : function read ( value , indent ) {
9743
- return typeof value === 'string' ? value : JSON . stringify ( value , null , Number ( indent ) || 2 ) ;
9779
+ return typeof value === 'string' ? value : JSON . stringify ( value , null , arguments . length > 1 ? indent : 2 ) ;
9744
9780
} ,
9745
9781
write : function write ( value ) {
9746
9782
try {
@@ -9998,7 +10034,9 @@ function installGlobalAPI (Vue) {
9998
10034
}
9999
10035
}
10000
10036
if ( type === 'component' && isPlainObject ( definition ) ) {
10001
- definition . name = id ;
10037
+ if ( ! definition . name ) {
10038
+ definition . name = id ;
10039
+ }
10002
10040
definition = Vue . extend ( definition ) ;
10003
10041
}
10004
10042
this . options [ type + 's' ] [ id ] = definition ;
@@ -10013,7 +10051,7 @@ function installGlobalAPI (Vue) {
10013
10051
10014
10052
installGlobalAPI ( Vue ) ;
10015
10053
10016
- Vue . version = '1.0.24 ' ;
10054
+ Vue . version = '1.0.25 ' ;
10017
10055
10018
10056
// devtools global hook
10019
10057
/* istanbul ignore next */
0 commit comments