@@ -179,12 +179,6 @@ function genStaticKeys(modules) {
179179}
180180
181181var config = {
182-
183- /**
184- * Preserve whitespaces between elements.
185- */
186- preserveWhitespace : true ,
187-
188182 /**
189183 * Option merge strategies (used in core/util/options)
190184 */
@@ -399,7 +393,8 @@ var proxyHandlers = void 0;
399393var initProxy = void 0 ;
400394if ( process . env . NODE_ENV !== 'production' ) {
401395 ( 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+ ) ;
403398
404399 hasProxy = typeof Proxy !== 'undefined' && Proxy . toString ( ) . match ( / n a t i v e c o d e / ) ;
405400
@@ -620,10 +615,11 @@ var Watcher = function () {
620615 if ( config . errorHandler ) {
621616 config . errorHandler . call ( null , e , this . vm ) ;
622617 } else {
623- warn ( e . stack ) ;
618+ throw e ;
624619 }
625620 }
626621 // return old value when evaluation fails so the current UI is preserved
622+ // if the error was somehow handled by user
627623 value = this . value ;
628624 }
629625 // "touch" every property so they are all tracked as
@@ -1304,9 +1300,9 @@ var VNode = function () {
13041300 return VNode ;
13051301} ( ) ;
13061302
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+ } ;
13101306
13111307function normalizeChildren ( children ) {
13121308 // invoke children thunks.
@@ -1326,13 +1322,8 @@ function normalizeChildren(children) {
13261322 if ( Array . isArray ( c ) ) {
13271323 res . push . apply ( res , normalizeChildren ( c ) ) ;
13281324 } 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 ) ) ;
13361327 } else if ( c instanceof VNode ) {
13371328 res . push ( c ) ;
13381329 }
@@ -1420,9 +1411,7 @@ function lifecycleMixin(Vue) {
14201411 var vm = this ;
14211412 vm . $el = el ;
14221413 if ( ! vm . $options . render ) {
1423- vm . $options . render = function ( ) {
1424- return emptyVNode ;
1425- } ;
1414+ vm . $options . render = emptyVNode ;
14261415 if ( process . env . NODE_ENV !== 'production' ) {
14271416 /* istanbul ignore if */
14281417 if ( vm . $options . template ) {
@@ -1799,7 +1788,7 @@ function renderElement(tag, data, namespace) {
17991788 }
18001789 if ( ! tag ) {
18011790 // in case of component :is set to falsy value
1802- return emptyVNode ;
1791+ return emptyVNode ( ) ;
18031792 }
18041793 if ( typeof tag === 'string' ) {
18051794 var Ctor = void 0 ;
@@ -1853,19 +1842,24 @@ function renderMixin(Vue) {
18531842
18541843 Vue . prototype . _render = function ( ) {
18551844 var vm = this ;
1845+
1846+ // set current active instance
18561847 var prev = renderState . activeInstance ;
18571848 renderState . activeInstance = vm ;
1858- if ( ! vm . _isMounted ) {
1859- // render static sub-trees for once on initial render
1860- renderStaticTrees ( vm ) ;
1861- }
1849+
18621850 var _vm$$options = vm . $options ;
18631851 var render = _vm$$options . render ;
1852+ var staticRenderFns = _vm$$options . staticRenderFns ;
18641853 var _renderChildren = _vm$$options . _renderChildren ;
18651854 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+ }
18661861 // resolve slots. becaues slots are rendered in parent scope,
18671862 // we set the activeInstance to parent.
1868-
18691863 if ( _renderChildren ) {
18701864 resolveSlots ( vm , _renderChildren ) ;
18711865 }
@@ -1876,7 +1870,7 @@ function renderMixin(Vue) {
18761870 if ( process . env . NODE_ENV !== 'production' && Array . isArray ( vnode ) ) {
18771871 warn ( 'Multiple root nodes returned from render function. Render function ' + 'should return a single root node.' , vm ) ;
18781872 }
1879- vnode = emptyVNode ;
1873+ vnode = emptyVNode ( ) ;
18801874 }
18811875 // set parent
18821876 vnode . parent = _parentVnode ;
@@ -1949,13 +1943,10 @@ function renderMixin(Vue) {
19491943 } ;
19501944}
19511945
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 ) ;
19591950 }
19601951}
19611952
@@ -2680,7 +2671,7 @@ function initAssetRegisters(Vue) {
26802671 }
26812672 }
26822673 if ( type === 'component' && isPlainObject ( definition ) ) {
2683- definition . name = id ;
2674+ definition . name = definition . name || id ;
26842675 definition = Vue . extend ( definition ) ;
26852676 }
26862677 this . options [ type + 's' ] [ id ] = definition ;
@@ -2764,7 +2755,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
27642755 }
27652756} ) ;
27662757
2767- Vue . version = '2.0.0-alpha.0 ' ;
2758+ Vue . version = '2.0.0-alpha.1 ' ;
27682759
27692760// attributes that should be using props for binding
27702761var mustUseProp = makeMap ( 'value,selected,checked,muted' ) ;
@@ -2958,6 +2949,10 @@ function childNodes(node) {
29582949 return node . childNodes ;
29592950}
29602951
2952+ function setAttribute ( node , key , val ) {
2953+ node . setAttribute ( key , val ) ;
2954+ }
2955+
29612956var nodeOps = Object . freeze ( {
29622957 createElement : createElement ,
29632958 createElementNS : createElementNS ,
@@ -2969,7 +2964,8 @@ var nodeOps = Object.freeze({
29692964 nextSibling : nextSibling ,
29702965 tagName : tagName ,
29712966 setTextContent : setTextContent ,
2972- childNodes : childNodes
2967+ childNodes : childNodes ,
2968+ setAttribute : setAttribute
29732969} ) ;
29742970
29752971var emptyNode = new VNode ( '' , { } , [ ] ) ;
@@ -3045,13 +3041,15 @@ function createPatchFunction(backend) {
30453041 // in that case we can just return the element and be done.
30463042 if ( isDef ( i = vnode . child ) ) {
30473043 invokeCreateHooks ( vnode , insertedVnodeQueue ) ;
3044+ setScope ( vnode ) ;
30483045 return vnode . elm ;
30493046 }
30503047 }
30513048 var children = vnode . children ;
30523049 var tag = vnode . tag ;
30533050 if ( isDef ( tag ) ) {
30543051 elm = vnode . elm = vnode . ns ? nodeOps . createElementNS ( vnode . ns , tag ) : nodeOps . createElement ( tag ) ;
3052+ setScope ( vnode ) ;
30553053 if ( Array . isArray ( children ) ) {
30563054 for ( i = 0 ; i < children . length ; ++ i ) {
30573055 nodeOps . appendChild ( elm , createElm ( children [ i ] , insertedVnodeQueue ) ) ;
@@ -3079,6 +3077,16 @@ function createPatchFunction(backend) {
30793077 }
30803078 }
30813079
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+
30823090 function addVnodes ( parentElm , before , vnodes , startIdx , endIdx , insertedVnodeQueue ) {
30833091 for ( ; startIdx <= endIdx ; ++ startIdx ) {
30843092 nodeOps . insertBefore ( parentElm , createElm ( vnodes [ startIdx ] , insertedVnodeQueue ) , before ) ;
@@ -3222,6 +3230,7 @@ function createPatchFunction(backend) {
32223230 }
32233231
32243232 function patchVnode ( oldVnode , vnode , insertedVnodeQueue ) {
3233+ if ( oldVnode === vnode ) return ;
32253234 var i = void 0 ,
32263235 hook = void 0 ;
32273236 if ( isDef ( i = vnode . data ) && isDef ( hook = i . hook ) && isDef ( i = hook . prepatch ) ) {
@@ -3230,7 +3239,6 @@ function createPatchFunction(backend) {
32303239 var elm = vnode . elm = oldVnode . elm ;
32313240 var oldCh = oldVnode . children ;
32323241 var ch = vnode . children ;
3233- if ( oldVnode === vnode ) return ;
32343242 if ( isDef ( vnode . data ) ) {
32353243 for ( i = 0 ; i < cbs . update . length ; ++ i ) {
32363244 cbs . update [ i ] ( oldVnode , vnode ) ;
0 commit comments