1
1
/*!
2
- * Vue.js v2.0.4
2
+ * Vue.js v2.0.5
3
3
* (c) 2014-2016 Evan You
4
4
* Released under the MIT License.
5
5
*/
@@ -1769,6 +1769,7 @@ function lifecycleMixin (Vue) {
1769
1769
{
1770
1770
observerState . isSettingProps = false ;
1771
1771
}
1772
+ vm . $options . propsData = propsData ;
1772
1773
}
1773
1774
// update listeners
1774
1775
if ( listeners ) {
@@ -2192,8 +2193,9 @@ function _createElement (
2192
2193
// unknown or unlisted namespaced elements
2193
2194
// check at runtime because it may get assigned a namespace when its
2194
2195
// parent normalizes children
2196
+ var childNs = tag === 'foreignObject' ? 'xhtml' : ns ;
2195
2197
return new VNode (
2196
- tag , data , normalizeChildren ( children , ns ) ,
2198
+ tag , data , normalizeChildren ( children , childNs ) ,
2197
2199
undefined , undefined , ns , context
2198
2200
)
2199
2201
}
@@ -2259,7 +2261,7 @@ function renderMixin (Vue) {
2259
2261
if ( config . _isServer ) {
2260
2262
throw e
2261
2263
} else {
2262
- setTimeout ( function ( ) { throw e } , 0 ) ;
2264
+ console . error ( e ) ;
2263
2265
}
2264
2266
}
2265
2267
// return previous vnode to prevent render error causing blank component
@@ -2847,25 +2849,16 @@ var defaultStrat = function (parentVal, childVal) {
2847
2849
} ;
2848
2850
2849
2851
/**
2850
- * Make sure component options get converted to actual
2851
- * constructors.
2852
+ * Validate component names
2852
2853
*/
2853
- function normalizeComponents ( options ) {
2854
- if ( options . components ) {
2855
- var components = options . components ;
2856
- var normalized = options . components = { } ;
2857
- var def ;
2858
- for ( var key in components ) {
2859
- var lower = key . toLowerCase ( ) ;
2860
- if ( isBuiltInTag ( lower ) || config . isReservedTag ( lower ) ) {
2861
- "development" !== 'production' && warn (
2862
- 'Do not use built-in or reserved HTML elements as component ' +
2863
- 'id: ' + key
2864
- ) ;
2865
- continue
2866
- }
2867
- def = components [ key ] ;
2868
- normalized [ key ] = isPlainObject ( def ) ? Vue$2 . extend ( def ) : def ;
2854
+ function checkComponents ( options ) {
2855
+ for ( var key in options . components ) {
2856
+ var lower = key . toLowerCase ( ) ;
2857
+ if ( isBuiltInTag ( lower ) || config . isReservedTag ( lower ) ) {
2858
+ warn (
2859
+ 'Do not use built-in or reserved HTML elements as component ' +
2860
+ 'id: ' + key
2861
+ ) ;
2869
2862
}
2870
2863
}
2871
2864
}
@@ -2926,7 +2919,9 @@ function mergeOptions (
2926
2919
child ,
2927
2920
vm
2928
2921
) {
2929
- normalizeComponents ( child ) ;
2922
+ {
2923
+ checkComponents ( child ) ;
2924
+ }
2930
2925
normalizeProps ( child ) ;
2931
2926
normalizeDirectives ( child ) ;
2932
2927
var extendsFrom = child . extends ;
@@ -3029,7 +3024,7 @@ function validateProp (
3029
3024
/**
3030
3025
* Get the default value of a prop.
3031
3026
*/
3032
- function getPropDefaultValue ( vm , prop , name ) {
3027
+ function getPropDefaultValue ( vm , prop , key ) {
3033
3028
// no default, return undefined
3034
3029
if ( ! hasOwn ( prop , 'default' ) ) {
3035
3030
return undefined
@@ -3038,12 +3033,19 @@ function getPropDefaultValue (vm, prop, name) {
3038
3033
// warn against non-factory defaults for Object & Array
3039
3034
if ( isObject ( def ) ) {
3040
3035
"development" !== 'production' && warn (
3041
- 'Invalid default value for prop "' + name + '": ' +
3036
+ 'Invalid default value for prop "' + key + '": ' +
3042
3037
'Props with type Object/Array must use a factory function ' +
3043
3038
'to return the default value.' ,
3044
3039
vm
3045
3040
) ;
3046
3041
}
3042
+ // the raw prop value was also undefined from previous render,
3043
+ // return previous default value to avoid unnecessary watcher trigger
3044
+ if ( vm && vm . $options . propsData &&
3045
+ vm . $options . propsData [ key ] === undefined &&
3046
+ vm [ key ] !== undefined ) {
3047
+ return vm [ key ]
3048
+ }
3047
3049
// call factory function for non-Function types
3048
3050
return typeof def === 'function' && prop . type !== Function
3049
3051
? def . call ( vm )
@@ -3408,7 +3410,7 @@ Object.defineProperty(Vue$2.prototype, '$isServer', {
3408
3410
get : function ( ) { return config . _isServer ; }
3409
3411
} ) ;
3410
3412
3411
- Vue$2 . version = '2.0.4 ' ;
3413
+ Vue$2 . version = '2.0.5 ' ;
3412
3414
3413
3415
/* */
3414
3416
@@ -3534,7 +3536,8 @@ function stringifyClass (value) {
3534
3536
3535
3537
var namespaceMap = {
3536
3538
svg : 'http://www.w3.org/2000/svg' ,
3537
- math : 'http://www.w3.org/1998/Math/MathML'
3539
+ math : 'http://www.w3.org/1998/Math/MathML' ,
3540
+ xhtml : 'http://www.w3.org/1999/xhtm'
3538
3541
} ;
3539
3542
3540
3543
var isHTMLTag = makeMap (
@@ -5724,6 +5727,8 @@ var startTagOpen = new RegExp('^<' + qnameCapture);
5724
5727
var startTagClose = / ^ \s * ( \/ ? ) > / ;
5725
5728
var endTag = new RegExp ( '^<\\/' + qnameCapture + '[^>]*>' ) ;
5726
5729
var doctype = / ^ < ! D O C T Y P E [ ^ > ] + > / i;
5730
+ var comment = / ^ < ! - - / ;
5731
+ var conditionalComment = / ^ < ! \[ / ;
5727
5732
5728
5733
var IS_REGEX_CAPTURING_BROKEN = false ;
5729
5734
'x' . replace ( / x ( .) ? / g, function ( m , g ) {
@@ -5781,7 +5786,7 @@ function parseHTML (html, options) {
5781
5786
var textEnd = html . indexOf ( '<' ) ;
5782
5787
if ( textEnd === 0 ) {
5783
5788
// Comment:
5784
- if ( / ^ < ! - - / . test ( html ) ) {
5789
+ if ( comment . test ( html ) ) {
5785
5790
var commentEnd = html . indexOf ( '-->' ) ;
5786
5791
5787
5792
if ( commentEnd >= 0 ) {
@@ -5791,7 +5796,7 @@ function parseHTML (html, options) {
5791
5796
}
5792
5797
5793
5798
// http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
5794
- if ( / ^ < ! \[ / . test ( html ) ) {
5799
+ if ( conditionalComment . test ( html ) ) {
5795
5800
var conditionalEnd = html . indexOf ( ']>' ) ;
5796
5801
5797
5802
if ( conditionalEnd >= 0 ) {
@@ -5824,12 +5829,19 @@ function parseHTML (html, options) {
5824
5829
}
5825
5830
}
5826
5831
5827
- var text = void 0 , rest$1 = void 0 ;
5832
+ var text = void 0 , rest$1 = void 0 , next = void 0 ;
5828
5833
if ( textEnd > 0 ) {
5829
5834
rest$1 = html . slice ( textEnd ) ;
5830
- while ( ! startTagOpen . test ( rest$1 ) && ! endTag . test ( rest$1 ) ) {
5835
+ while (
5836
+ ! endTag . test ( rest$1 ) &&
5837
+ ! startTagOpen . test ( rest$1 ) &&
5838
+ ! comment . test ( rest$1 ) &&
5839
+ ! conditionalComment . test ( rest$1 )
5840
+ ) {
5831
5841
// < in plain text, be forgiving and treat it as text
5832
- textEnd += rest$1 . indexOf ( '<' , 1 ) ;
5842
+ next = rest$1 . indexOf ( '<' , 1 ) ;
5843
+ if ( next < 0 ) { break }
5844
+ textEnd += next ;
5833
5845
rest$1 = html . slice ( textEnd ) ;
5834
5846
}
5835
5847
text = html . substring ( 0 , textEnd ) ;
@@ -5865,8 +5877,9 @@ function parseHTML (html, options) {
5865
5877
parseEndTag ( '</' + stackedTag + '>' , stackedTag , index - endTagLength , index ) ;
5866
5878
}
5867
5879
5868
- if ( html === last ) {
5869
- throw new Error ( 'Error parsing template:\n\n' + html )
5880
+ if ( html === last && options . chars ) {
5881
+ options . chars ( html ) ;
5882
+ break
5870
5883
}
5871
5884
}
5872
5885
0 commit comments