@@ -179,12 +179,6 @@ function genStaticKeys(modules) {
179
179
}
180
180
181
181
var config = {
182
-
183
- /**
184
- * Preserve whitespaces between elements.
185
- */
186
- preserveWhitespace : true ,
187
-
188
182
/**
189
183
* Option merge strategies (used in core/util/options)
190
184
*/
@@ -399,7 +393,8 @@ var proxyHandlers = void 0;
399
393
var initProxy = void 0 ;
400
394
if ( process . env . NODE_ENV !== 'production' ) {
401
395
( function ( ) {
402
- var allowedGlobals = makeMap ( 'Infinity,undefined,NaN,isFinite,isNaN,' + 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl' ) ;
396
+ var allowedGlobals = makeMap ( 'Infinity,undefined,NaN,isFinite,isNaN,' + 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + 'require,__webpack_require__' // for Webpack/Browserify
397
+ ) ;
403
398
404
399
hasProxy = typeof Proxy !== 'undefined' && Proxy . toString ( ) . match ( / n a t i v e c o d e / ) ;
405
400
@@ -620,10 +615,11 @@ var Watcher = function () {
620
615
if ( config . errorHandler ) {
621
616
config . errorHandler . call ( null , e , this . vm ) ;
622
617
} else {
623
- warn ( e . stack ) ;
618
+ throw e ;
624
619
}
625
620
}
626
621
// return old value when evaluation fails so the current UI is preserved
622
+ // if the error was somehow handled by user
627
623
value = this . value ;
628
624
}
629
625
// "touch" every property so they are all tracked as
@@ -1304,9 +1300,9 @@ var VNode = function () {
1304
1300
return VNode ;
1305
1301
} ( ) ;
1306
1302
1307
- var emptyVNode = new VNode ( undefined , undefined , undefined , '' ) ;
1308
-
1309
- var whitespace = new VNode ( undefined , undefined , undefined , ' ' ) ;
1303
+ var emptyVNode = function emptyVNode ( ) {
1304
+ return new VNode ( undefined , undefined , undefined , '' ) ;
1305
+ } ;
1310
1306
1311
1307
function normalizeChildren ( children ) {
1312
1308
// invoke children thunks.
@@ -1326,13 +1322,8 @@ function normalizeChildren(children) {
1326
1322
if ( Array . isArray ( c ) ) {
1327
1323
res . push . apply ( res , normalizeChildren ( c ) ) ;
1328
1324
} else if ( isPrimitive ( c ) ) {
1329
- // optimize whitespace
1330
- if ( c === ' ' ) {
1331
- res . push ( whitespace ) ;
1332
- } else {
1333
- // convert primitive to vnode
1334
- res . push ( new VNode ( undefined , undefined , undefined , c ) ) ;
1335
- }
1325
+ // convert primitive to vnode
1326
+ res . push ( new VNode ( undefined , undefined , undefined , c ) ) ;
1336
1327
} else if ( c instanceof VNode ) {
1337
1328
res . push ( c ) ;
1338
1329
}
@@ -1420,9 +1411,7 @@ function lifecycleMixin(Vue) {
1420
1411
var vm = this ;
1421
1412
vm . $el = el ;
1422
1413
if ( ! vm . $options . render ) {
1423
- vm . $options . render = function ( ) {
1424
- return emptyVNode ;
1425
- } ;
1414
+ vm . $options . render = emptyVNode ;
1426
1415
if ( process . env . NODE_ENV !== 'production' ) {
1427
1416
/* istanbul ignore if */
1428
1417
if ( vm . $options . template ) {
@@ -1799,7 +1788,7 @@ function renderElement(tag, data, namespace) {
1799
1788
}
1800
1789
if ( ! tag ) {
1801
1790
// in case of component :is set to falsy value
1802
- return emptyVNode ;
1791
+ return emptyVNode ( ) ;
1803
1792
}
1804
1793
if ( typeof tag === 'string' ) {
1805
1794
var Ctor = void 0 ;
@@ -1853,19 +1842,24 @@ function renderMixin(Vue) {
1853
1842
1854
1843
Vue . prototype . _render = function ( ) {
1855
1844
var vm = this ;
1845
+
1846
+ // set current active instance
1856
1847
var prev = renderState . activeInstance ;
1857
1848
renderState . activeInstance = vm ;
1858
- if ( ! vm . _isMounted ) {
1859
- // render static sub-trees for once on initial render
1860
- renderStaticTrees ( vm ) ;
1861
- }
1849
+
1862
1850
var _vm$$options = vm . $options ;
1863
1851
var render = _vm$$options . render ;
1852
+ var staticRenderFns = _vm$$options . staticRenderFns ;
1864
1853
var _renderChildren = _vm$$options . _renderChildren ;
1865
1854
var _parentVnode = _vm$$options . _parentVnode ;
1855
+
1856
+
1857
+ if ( staticRenderFns && ! vm . _staticTrees ) {
1858
+ // render static sub-trees for once on initial render
1859
+ renderStaticTrees ( vm , staticRenderFns ) ;
1860
+ }
1866
1861
// resolve slots. becaues slots are rendered in parent scope,
1867
1862
// we set the activeInstance to parent.
1868
-
1869
1863
if ( _renderChildren ) {
1870
1864
resolveSlots ( vm , _renderChildren ) ;
1871
1865
}
@@ -1876,7 +1870,7 @@ function renderMixin(Vue) {
1876
1870
if ( process . env . NODE_ENV !== 'production' && Array . isArray ( vnode ) ) {
1877
1871
warn ( 'Multiple root nodes returned from render function. Render function ' + 'should return a single root node.' , vm ) ;
1878
1872
}
1879
- vnode = emptyVNode ;
1873
+ vnode = emptyVNode ( ) ;
1880
1874
}
1881
1875
// set parent
1882
1876
vnode . parent = _parentVnode ;
@@ -1949,13 +1943,10 @@ function renderMixin(Vue) {
1949
1943
} ;
1950
1944
}
1951
1945
1952
- function renderStaticTrees ( vm ) {
1953
- var staticRenderFns = vm . $options . staticRenderFns ;
1954
- if ( staticRenderFns ) {
1955
- var trees = vm . _staticTrees = new Array ( staticRenderFns . length ) ;
1956
- for ( var i = 0 ; i < staticRenderFns . length ; i ++ ) {
1957
- trees [ i ] = staticRenderFns [ i ] . call ( vm . _renderProxy ) ;
1958
- }
1946
+ function renderStaticTrees ( vm , fns ) {
1947
+ var trees = vm . _staticTrees = new Array ( fns . length ) ;
1948
+ for ( var i = 0 ; i < fns . length ; i ++ ) {
1949
+ trees [ i ] = fns [ i ] . call ( vm . _renderProxy ) ;
1959
1950
}
1960
1951
}
1961
1952
@@ -2680,7 +2671,7 @@ function initAssetRegisters(Vue) {
2680
2671
}
2681
2672
}
2682
2673
if ( type === 'component' && isPlainObject ( definition ) ) {
2683
- definition . name = id ;
2674
+ definition . name = definition . name || id ;
2684
2675
definition = Vue . extend ( definition ) ;
2685
2676
}
2686
2677
this . options [ type + 's' ] [ id ] = definition ;
@@ -2764,7 +2755,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
2764
2755
}
2765
2756
} ) ;
2766
2757
2767
- Vue . version = '2.0.0-alpha.0 ' ;
2758
+ Vue . version = '2.0.0-alpha.1 ' ;
2768
2759
2769
2760
// attributes that should be using props for binding
2770
2761
var mustUseProp = makeMap ( 'value,selected,checked,muted' ) ;
@@ -2958,6 +2949,10 @@ function childNodes(node) {
2958
2949
return node . childNodes ;
2959
2950
}
2960
2951
2952
+ function setAttribute ( node , key , val ) {
2953
+ node . setAttribute ( key , val ) ;
2954
+ }
2955
+
2961
2956
var nodeOps = Object . freeze ( {
2962
2957
createElement : createElement ,
2963
2958
createElementNS : createElementNS ,
@@ -2969,7 +2964,8 @@ var nodeOps = Object.freeze({
2969
2964
nextSibling : nextSibling ,
2970
2965
tagName : tagName ,
2971
2966
setTextContent : setTextContent ,
2972
- childNodes : childNodes
2967
+ childNodes : childNodes ,
2968
+ setAttribute : setAttribute
2973
2969
} ) ;
2974
2970
2975
2971
var emptyNode = new VNode ( '' , { } , [ ] ) ;
@@ -3045,13 +3041,15 @@ function createPatchFunction(backend) {
3045
3041
// in that case we can just return the element and be done.
3046
3042
if ( isDef ( i = vnode . child ) ) {
3047
3043
invokeCreateHooks ( vnode , insertedVnodeQueue ) ;
3044
+ setScope ( vnode ) ;
3048
3045
return vnode . elm ;
3049
3046
}
3050
3047
}
3051
3048
var children = vnode . children ;
3052
3049
var tag = vnode . tag ;
3053
3050
if ( isDef ( tag ) ) {
3054
3051
elm = vnode . elm = vnode . ns ? nodeOps . createElementNS ( vnode . ns , tag ) : nodeOps . createElement ( tag ) ;
3052
+ setScope ( vnode ) ;
3055
3053
if ( Array . isArray ( children ) ) {
3056
3054
for ( i = 0 ; i < children . length ; ++ i ) {
3057
3055
nodeOps . appendChild ( elm , createElm ( children [ i ] , insertedVnodeQueue ) ) ;
@@ -3079,6 +3077,16 @@ function createPatchFunction(backend) {
3079
3077
}
3080
3078
}
3081
3079
3080
+ // set scope id attribute for scoped CSS.
3081
+ // this is implemented as a special case to avoid the overhead
3082
+ // of going through the normal attribute patching process.
3083
+ function setScope ( vnode ) {
3084
+ var i = void 0 ;
3085
+ if ( isDef ( i = vnode . context ) && isDef ( i = i . $options . _scopeId ) ) {
3086
+ nodeOps . setAttribute ( vnode . elm , i , '' ) ;
3087
+ }
3088
+ }
3089
+
3082
3090
function addVnodes ( parentElm , before , vnodes , startIdx , endIdx , insertedVnodeQueue ) {
3083
3091
for ( ; startIdx <= endIdx ; ++ startIdx ) {
3084
3092
nodeOps . insertBefore ( parentElm , createElm ( vnodes [ startIdx ] , insertedVnodeQueue ) , before ) ;
@@ -3222,6 +3230,7 @@ function createPatchFunction(backend) {
3222
3230
}
3223
3231
3224
3232
function patchVnode ( oldVnode , vnode , insertedVnodeQueue ) {
3233
+ if ( oldVnode === vnode ) return ;
3225
3234
var i = void 0 ,
3226
3235
hook = void 0 ;
3227
3236
if ( isDef ( i = vnode . data ) && isDef ( hook = i . hook ) && isDef ( i = hook . prepatch ) ) {
@@ -3230,7 +3239,6 @@ function createPatchFunction(backend) {
3230
3239
var elm = vnode . elm = oldVnode . elm ;
3231
3240
var oldCh = oldVnode . children ;
3232
3241
var ch = vnode . children ;
3233
- if ( oldVnode === vnode ) return ;
3234
3242
if ( isDef ( vnode . data ) ) {
3235
3243
for ( i = 0 ; i < cbs . update . length ; ++ i ) {
3236
3244
cbs . update [ i ] ( oldVnode , vnode ) ;
0 commit comments