@@ -152,12 +152,9 @@ var capitalize = cached(function (str) {
152
152
/**
153
153
* Hyphenate a camelCase string.
154
154
*/
155
- var hyphenateRE = / ( [ ^ - ] ) ( [ A - Z ] ) / g;
155
+ var hyphenateRE = / \B ( [ A - Z ] ) / g;
156
156
var hyphenate = cached ( function ( str ) {
157
- return str
158
- . replace ( hyphenateRE , '$1-$2' )
159
- . replace ( hyphenateRE , '$1-$2' )
160
- . toLowerCase ( )
157
+ return str . replace ( hyphenateRE , '-$1' ) . toLowerCase ( )
161
158
} ) ;
162
159
163
160
/**
@@ -284,8 +281,6 @@ function escape (s) {
284
281
return s . replace ( / [ < > " & ] / g, escapeChar )
285
282
}
286
283
287
- var cachedEscape = cached ( escape ) ;
288
-
289
284
function escapeChar ( a ) {
290
285
return ESC [ a ] || a
291
286
}
@@ -297,7 +292,7 @@ function escapeChar (a) {
297
292
var isReservedAttr = makeMap ( 'style,class' ) ;
298
293
299
294
// attributes that should be using props for binding
300
- var acceptValue = makeMap ( 'input,textarea,option,select' ) ;
295
+ var acceptValue = makeMap ( 'input,textarea,option,select,progress ' ) ;
301
296
var mustUseProp = function ( tag , type , attr ) {
302
297
return (
303
298
( attr === 'value' && acceptValue ( tag ) ) && type !== 'button' ||
@@ -367,7 +362,7 @@ function renderAttr (key, value) {
367
362
} else if ( isEnumeratedAttr ( key ) ) {
368
363
return ( " " + key + "=\"" + ( isFalsyAttrValue ( value ) || value === 'false' ? 'false' : 'true' ) + "\"" )
369
364
} else if ( ! isFalsyAttrValue ( value ) ) {
370
- return ( " " + key + "=\"" + ( typeof value === 'string' ? cachedEscape ( value ) : value ) + "\"" )
365
+ return ( " " + key + "=\"" + ( escape ( String ( value ) ) ) + "\"" )
371
366
}
372
367
return ''
373
368
}
@@ -758,7 +753,7 @@ var isAndroid = UA && UA.indexOf('android') > 0;
758
753
var isIOS = UA && / i p h o n e | i p a d | i p o d | i o s / . test ( UA ) ;
759
754
var isChrome = UA && / c h r o m e \/ \d + / . test ( UA ) && ! isEdge ;
760
755
761
- // Firefix has a "watch" function on Object.prototype...
756
+ // Firefox has a "watch" function on Object.prototype...
762
757
var nativeWatch = ( { } ) . watch ;
763
758
764
759
var supportsPassive = false ;
@@ -840,13 +835,13 @@ var nextTick = (function () {
840
835
// "force" the microtask queue to be flushed by adding an empty timer.
841
836
if ( isIOS ) { setTimeout ( noop ) ; }
842
837
} ;
843
- } else if ( typeof MutationObserver !== 'undefined' && (
838
+ } else if ( ! isIE && typeof MutationObserver !== 'undefined' && (
844
839
isNative ( MutationObserver ) ||
845
840
// PhantomJS and iOS 7.x
846
841
MutationObserver . toString ( ) === '[object MutationObserverConstructor]'
847
842
) ) {
848
843
// use MutationObserver where native Promise is not available,
849
- // e.g. PhantomJS IE11 , iOS7, Android 4.4
844
+ // e.g. PhantomJS, iOS7, Android 4.4
850
845
var counter = 1 ;
851
846
var observer = new MutationObserver ( nextTickHandler ) ;
852
847
var textNode = document . createTextNode ( String ( counter ) ) ;
@@ -1146,9 +1141,9 @@ function defineReactive$$1 (
1146
1141
dep . depend ( ) ;
1147
1142
if ( childOb ) {
1148
1143
childOb . dep . depend ( ) ;
1149
- }
1150
- if ( Array . isArray ( value ) ) {
1151
- dependArray ( value ) ;
1144
+ if ( Array . isArray ( value ) ) {
1145
+ dependArray ( value ) ;
1146
+ }
1152
1147
}
1153
1148
}
1154
1149
return value
@@ -1304,7 +1299,7 @@ function mergeDataOrFn (
1304
1299
: childVal ;
1305
1300
var defaultData = typeof parentVal === 'function'
1306
1301
? parentVal . call ( vm )
1307
- : undefined ;
1302
+ : parentVal ;
1308
1303
if ( instanceData ) {
1309
1304
return mergeData ( instanceData , defaultData )
1310
1305
} else {
@@ -1707,7 +1702,12 @@ function assertType (value, type) {
1707
1702
var valid ;
1708
1703
var expectedType = getType ( type ) ;
1709
1704
if ( simpleCheckRE . test ( expectedType ) ) {
1710
- valid = typeof value === expectedType . toLowerCase ( ) ;
1705
+ var t = typeof value ;
1706
+ valid = t === expectedType . toLowerCase ( ) ;
1707
+ // for primitive wrapper objects
1708
+ if ( ! valid && t === 'object' ) {
1709
+ valid = value instanceof type ;
1710
+ }
1711
1711
} else if ( expectedType === 'Object' ) {
1712
1712
valid = isPlainObject ( value ) ;
1713
1713
} else if ( expectedType === 'Array' ) {
@@ -1871,6 +1871,10 @@ function getTagNamespace (tag) {
1871
1871
}
1872
1872
}
1873
1873
1874
+
1875
+
1876
+ var isTextInputType = makeMap ( 'text,number,password,search,email,tel,url' ) ;
1877
+
1874
1878
/* */
1875
1879
1876
1880
/**
@@ -1882,7 +1886,7 @@ function getTagNamespace (tag) {
1882
1886
function renderClass ( node ) {
1883
1887
var classList = genClassForVnode ( node ) ;
1884
1888
if ( classList !== '' ) {
1885
- return ( " class=\"" + ( cachedEscape ( classList ) ) + "\"" )
1889
+ return ( " class=\"" + ( escape ( classList ) ) + "\"" )
1886
1890
}
1887
1891
}
1888
1892
@@ -1974,7 +1978,7 @@ function genStyle (style) {
1974
1978
function renderStyle ( vnode ) {
1975
1979
var styleText = genStyle ( getStyle ( vnode , false ) ) ;
1976
1980
if ( styleText !== '' ) {
1977
- return ( " style=" + ( JSON . stringify ( cachedEscape ( styleText ) ) ) )
1981
+ return ( " style=" + ( JSON . stringify ( escape ( styleText ) ) ) )
1978
1982
}
1979
1983
}
1980
1984
@@ -2718,7 +2722,7 @@ function genCheckboxModel (
2718
2722
'if(Array.isArray($$a)){' +
2719
2723
"var $$v=" + ( number ? '_n(' + valueBinding + ')' : valueBinding ) + "," +
2720
2724
'$$i=_i($$a,$$v);' +
2721
- "if($$el.checked){$$i<0&&(" + value + "=$$a.concat($$v))}" +
2725
+ "if($$el.checked){$$i<0&&(" + value + "=$$a.concat([ $$v] ))}" +
2722
2726
"else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
2723
2727
"}else{" + ( genAssignmentCode ( value , '$$c' ) ) + "}" ,
2724
2728
null , true
@@ -3195,29 +3199,14 @@ var he = createCommonjsModule(function (module, exports) {
3195
3199
*/
3196
3200
3197
3201
// Regular Expressions for parsing tags and attributes
3198
- var singleAttrIdentifier = / ( [ ^ \s " ' < > / = ] + ) / ;
3199
- var singleAttrAssign = / (?: = ) / ;
3200
- var singleAttrValues = [
3201
- // attr value double quotes
3202
- / " ( [ ^ " ] * ) " + / . source ,
3203
- // attr value, single quotes
3204
- / ' ( [ ^ ' ] * ) ' + / . source ,
3205
- // attr value, no quotes
3206
- / ( [ ^ \s " ' = < > ` ] + ) / . source
3207
- ] ;
3208
- var attribute = new RegExp (
3209
- '^\\s*' + singleAttrIdentifier . source +
3210
- '(?:\\s*(' + singleAttrAssign . source + ')' +
3211
- '\\s*(?:' + singleAttrValues . join ( '|' ) + '))?'
3212
- ) ;
3213
-
3202
+ var attribute = / ^ \s * ( [ ^ \s " ' < > \/ = ] + ) (?: \s * ( = ) \s * (?: " ( [ ^ " ] * ) " + | ' ( [ ^ ' ] * ) ' + | ( [ ^ \s " ' = < > ` ] + ) ) ) ? / ;
3214
3203
// could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
3215
3204
// but for Vue templates we can enforce a simple charset
3216
3205
var ncname = '[a-zA-Z_][\\w\\-\\.]*' ;
3217
- var qnameCapture = ' ((?:' + ncname + ' \\:)?' + ncname + ')' ;
3218
- var startTagOpen = new RegExp ( '^<' + qnameCapture ) ;
3206
+ var qnameCapture = " ((?:" + ncname + " \\:)?" + ncname + ")" ;
3207
+ var startTagOpen = new RegExp ( ( "^<" + qnameCapture ) ) ;
3219
3208
var startTagClose = / ^ \s * ( \/ ? ) > / ;
3220
- var endTag = new RegExp ( ' ^<\\/' + qnameCapture + ' [^>]*>' ) ;
3209
+ var endTag = new RegExp ( ( " ^<\\/" + qnameCapture + " [^>]*>" ) ) ;
3221
3210
var doctype = / ^ < ! D O C T Y P E [ ^ > ] + > / i;
3222
3211
var comment = / ^ < ! - - / ;
3223
3212
var conditionalComment = / ^ < ! \[ / ;
@@ -3917,6 +3906,8 @@ function processSlot (el) {
3917
3906
var slotTarget = getBindingAttr ( el , 'slot' ) ;
3918
3907
if ( slotTarget ) {
3919
3908
el . slotTarget = slotTarget === '""' ? '"default"' : slotTarget ;
3909
+ // preserve slot as an attribute for native shadow DOM compat
3910
+ addAttr ( el , 'slot' , slotTarget ) ;
3920
3911
}
3921
3912
if ( el . tag === 'template' ) {
3922
3913
el . slotScope = getAndRemoveAttr ( el , 'scope' ) ;
@@ -4326,7 +4317,7 @@ function genOnce (el, state) {
4326
4317
) ;
4327
4318
return genElement ( el , state )
4328
4319
}
4329
- return ( "_o(" + ( genElement ( el , state ) ) + "," + ( state . onceId ++ ) + ( key ? ( "," + key ) : "" ) + ")" )
4320
+ return ( "_o(" + ( genElement ( el , state ) ) + "," + ( state . onceId ++ ) + "," + key + ")" )
4330
4321
} else {
4331
4322
return genStatic ( el , state )
4332
4323
}
@@ -5075,10 +5066,10 @@ function elementToOpenTagSegments (el, state) {
5075
5066
function childrenToSegments ( el , state ) {
5076
5067
var binding ;
5077
5068
if ( ( binding = el . attrsMap [ 'v-html' ] ) ) {
5078
- return [ { type : EXPRESSION , value : binding } ]
5069
+ return [ { type : EXPRESSION , value : ( "_s(" + binding + ")" ) } ]
5079
5070
}
5080
5071
if ( ( binding = el . attrsMap [ 'v-text' ] ) ) {
5081
- return [ { type : INTERPOLATION , value : binding } ]
5072
+ return [ { type : INTERPOLATION , value : ( "_s(" + binding + ")" ) } ]
5082
5073
}
5083
5074
return el . children
5084
5075
? nodesToSegments ( el . children , state )
@@ -5097,7 +5088,7 @@ function nodesToSegments (
5097
5088
} else if ( c . type === 2 ) {
5098
5089
segments . push ( { type : INTERPOLATION , value : c . expression } ) ;
5099
5090
} else if ( c . type === 3 ) {
5100
- segments . push ( { type : RAW , value : c . text } ) ;
5091
+ segments . push ( { type : RAW , value : escape ( c . text ) } ) ;
5101
5092
}
5102
5093
}
5103
5094
return segments
@@ -5571,7 +5562,7 @@ function renderSSRClass (
5571
5562
dynamic
5572
5563
) {
5573
5564
var res = renderClass$1 ( staticClass , dynamic ) ;
5574
- return res === '' ? res : ( " class=\"" + ( cachedEscape ( res ) ) + "\"" )
5565
+ return res === '' ? res : ( " class=\"" + ( escape ( res ) ) + "\"" )
5575
5566
}
5576
5567
5577
5568
function renderSSRStyle (
@@ -5584,7 +5575,7 @@ function renderSSRStyle (
5584
5575
if ( dynamic ) { extend ( style , normalizeStyleBinding ( dynamic ) ) ; }
5585
5576
if ( extra ) { extend ( style , extra ) ; }
5586
5577
var res = genStyle ( style ) ;
5587
- return res === '' ? res : ( " style=" + ( JSON . stringify ( cachedEscape ( res ) ) ) )
5578
+ return res === '' ? res : ( " style=" + ( JSON . stringify ( escape ( res ) ) ) )
5588
5579
}
5589
5580
5590
5581
/* not type checking this file because flow doesn't play well with Proxy */
@@ -5693,8 +5684,10 @@ var normalizeEvent = cached(function (name) {
5693
5684
name = once$$1 ? name . slice ( 1 ) : name ;
5694
5685
var capture = name . charAt ( 0 ) === '!' ;
5695
5686
name = capture ? name . slice ( 1 ) : name ;
5687
+ var plain = ! ( passive || once$$1 || capture ) ;
5696
5688
return {
5697
5689
name : name ,
5690
+ plain : plain ,
5698
5691
once : once$$1 ,
5699
5692
capture : capture ,
5700
5693
passive : passive
@@ -5720,6 +5713,11 @@ function createFnInvoker (fns) {
5720
5713
return invoker
5721
5714
}
5722
5715
5716
+ // #6552
5717
+ function prioritizePlainEvents ( a , b ) {
5718
+ return a . plain ? - 1 : b . plain ? 1 : 0
5719
+ }
5720
+
5723
5721
function updateListeners (
5724
5722
on ,
5725
5723
oldOn ,
@@ -5728,10 +5726,13 @@ function updateListeners (
5728
5726
vm
5729
5727
) {
5730
5728
var name , cur , old , event ;
5729
+ var toAdd = [ ] ;
5730
+ var hasModifier = false ;
5731
5731
for ( name in on ) {
5732
5732
cur = on [ name ] ;
5733
5733
old = oldOn [ name ] ;
5734
5734
event = normalizeEvent ( name ) ;
5735
+ if ( ! event . plain ) { hasModifier = true ; }
5735
5736
if ( isUndef ( cur ) ) {
5736
5737
"development" !== 'production' && warn (
5737
5738
"Invalid handler for event \"" + ( event . name ) + "\": got " + String ( cur ) ,
@@ -5741,12 +5742,20 @@ function updateListeners (
5741
5742
if ( isUndef ( cur . fns ) ) {
5742
5743
cur = on [ name ] = createFnInvoker ( cur ) ;
5743
5744
}
5744
- add ( event . name , cur , event . once , event . capture , event . passive ) ;
5745
+ event . handler = cur ;
5746
+ toAdd . push ( event ) ;
5745
5747
} else if ( cur !== old ) {
5746
5748
old . fns = cur ;
5747
5749
on [ name ] = old ;
5748
5750
}
5749
5751
}
5752
+ if ( toAdd . length ) {
5753
+ if ( hasModifier ) { toAdd . sort ( prioritizePlainEvents ) ; }
5754
+ for ( var i = 0 ; i < toAdd . length ; i ++ ) {
5755
+ var event$1 = toAdd [ i ] ;
5756
+ add ( event$1 . name , event$1 . handler , event$1 . once , event$1 . capture , event$1 . passive ) ;
5757
+ }
5758
+ }
5750
5759
for ( name in oldOn ) {
5751
5760
if ( isUndef ( on [ name ] ) ) {
5752
5761
event = normalizeEvent ( name ) ;
@@ -5955,6 +5964,8 @@ function resolveAsyncComponent (
5955
5964
5956
5965
/* */
5957
5966
5967
+ /* */
5968
+
5958
5969
5959
5970
5960
5971
var target ;
@@ -5996,10 +6007,15 @@ function resolveSlots (
5996
6007
var defaultSlot = [ ] ;
5997
6008
for ( var i = 0 , l = children . length ; i < l ; i ++ ) {
5998
6009
var child = children [ i ] ;
6010
+ var data = child . data ;
6011
+ // remove slot attribute if the node is resolved as a Vue slot node
6012
+ if ( data && data . attrs && data . attrs . slot ) {
6013
+ delete data . attrs . slot ;
6014
+ }
5999
6015
// named slots should only be respected if the vnode was rendered in the
6000
6016
// same context.
6001
6017
if ( ( child . context === context || child . functionalContext === context ) &&
6002
- child . data && child . data . slot != null
6018
+ data && data . slot != null
6003
6019
) {
6004
6020
var name = child . data . slot ;
6005
6021
var slot = ( slots [ name ] || ( slots [ name ] = [ ] ) ) ;
@@ -6062,11 +6078,11 @@ function updateChildComponent (
6062
6078
}
6063
6079
vm . $options . _renderChildren = renderChildren ;
6064
6080
6065
- // update $attrs and $listensers hash
6081
+ // update $attrs and $listeners hash
6066
6082
// these are also reactive so they may trigger child update if the child
6067
6083
// used them during render
6068
- vm . $attrs = parentVnode . data && parentVnode . data . attrs ;
6069
- vm . $listeners = listeners ;
6084
+ vm . $attrs = ( parentVnode . data && parentVnode . data . attrs ) || emptyObject ;
6085
+ vm . $listeners = listeners || emptyObject ;
6070
6086
6071
6087
// update props
6072
6088
if ( propsData && vm . $options . props ) {
@@ -6642,7 +6658,7 @@ function _createElement (
6642
6658
var vnode , ns ;
6643
6659
if ( typeof tag === 'string' ) {
6644
6660
var Ctor ;
6645
- ns = config . getTagNamespace ( tag ) ;
6661
+ ns = ( context . $vnode && context . $vnode . ns ) || config . getTagNamespace ( tag ) ;
6646
6662
if ( config . isReservedTag ( tag ) ) {
6647
6663
// platform built-in elements
6648
6664
vnode = new VNode (
@@ -6746,7 +6762,10 @@ function resolveInject (inject, vm) {
6746
6762
// inject is :any because flow is not smart enough to figure out cached
6747
6763
var result = Object . create ( null ) ;
6748
6764
var keys = hasSymbol
6749
- ? Reflect . ownKeys ( inject )
6765
+ ? Reflect . ownKeys ( inject ) . filter ( function ( key ) {
6766
+ /* istanbul ignore next */
6767
+ return Object . getOwnPropertyDescriptor ( inject , key ) . enumerable
6768
+ } )
6750
6769
: Object . keys ( inject ) ;
6751
6770
6752
6771
for ( var i = 0 ; i < keys . length ; i ++ ) {
@@ -6842,7 +6861,7 @@ function createFunctionalComponent (
6842
6861
var propOptions = Ctor . options . props ;
6843
6862
if ( isDef ( propOptions ) ) {
6844
6863
for ( var key in propOptions ) {
6845
- props [ key ] = validateProp ( key , propOptions , propsData || { } ) ;
6864
+ props [ key ] = validateProp ( key , propOptions , propsData || emptyObject ) ;
6846
6865
}
6847
6866
} else {
6848
6867
if ( isDef ( data . attrs ) ) { mergeProps ( props , data . attrs ) ; }
@@ -6857,7 +6876,7 @@ function createFunctionalComponent (
6857
6876
props : props ,
6858
6877
children : children ,
6859
6878
parent : context ,
6860
- listeners : data . on || { } ,
6879
+ listeners : data . on || emptyObject ,
6861
6880
injections : resolveInject ( Ctor . options . inject , context ) ,
6862
6881
slots : function ( ) { return resolveSlots ( children , context ) ; }
6863
6882
} ) ;
0 commit comments