vuejs 1.0.31 → 1.0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/helpers/syntax_helper.rb +7 -0
- data/lib/vuejs.rb +28 -1
- data/lib/vuejs/version.rb +1 -1
- data/vendor/assets/javascripts/vue-resource.js +1 -1
- data/vendor/assets/javascripts/vue-router2.js +558 -333
- data/vendor/assets/javascripts/vue-validator.js +1811 -11
- data/vendor/assets/javascripts/vue2.js +788 -578
- metadata +4 -3
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Vue.js v2.1.
|
2
|
+
* Vue.js v2.1.6
|
3
3
|
* (c) 2014-2016 Evan You
|
4
4
|
* Released under the MIT License.
|
5
5
|
*/
|
@@ -200,6 +200,11 @@ function noop () {}
|
|
200
200
|
*/
|
201
201
|
var no = function () { return false; };
|
202
202
|
|
203
|
+
/**
|
204
|
+
* Return same value
|
205
|
+
*/
|
206
|
+
var identity = function (_) { return _; };
|
207
|
+
|
203
208
|
/**
|
204
209
|
* Generate a static keys string from compiler modules.
|
205
210
|
*/
|
@@ -232,6 +237,98 @@ function looseIndexOf (arr, val) {
|
|
232
237
|
|
233
238
|
/* */
|
234
239
|
|
240
|
+
var config = {
|
241
|
+
/**
|
242
|
+
* Option merge strategies (used in core/util/options)
|
243
|
+
*/
|
244
|
+
optionMergeStrategies: Object.create(null),
|
245
|
+
|
246
|
+
/**
|
247
|
+
* Whether to suppress warnings.
|
248
|
+
*/
|
249
|
+
silent: false,
|
250
|
+
|
251
|
+
/**
|
252
|
+
* Whether to enable devtools
|
253
|
+
*/
|
254
|
+
devtools: "development" !== 'production',
|
255
|
+
|
256
|
+
/**
|
257
|
+
* Error handler for watcher errors
|
258
|
+
*/
|
259
|
+
errorHandler: null,
|
260
|
+
|
261
|
+
/**
|
262
|
+
* Ignore certain custom elements
|
263
|
+
*/
|
264
|
+
ignoredElements: null,
|
265
|
+
|
266
|
+
/**
|
267
|
+
* Custom user key aliases for v-on
|
268
|
+
*/
|
269
|
+
keyCodes: Object.create(null),
|
270
|
+
|
271
|
+
/**
|
272
|
+
* Check if a tag is reserved so that it cannot be registered as a
|
273
|
+
* component. This is platform-dependent and may be overwritten.
|
274
|
+
*/
|
275
|
+
isReservedTag: no,
|
276
|
+
|
277
|
+
/**
|
278
|
+
* Check if a tag is an unknown element.
|
279
|
+
* Platform-dependent.
|
280
|
+
*/
|
281
|
+
isUnknownElement: no,
|
282
|
+
|
283
|
+
/**
|
284
|
+
* Get the namespace of an element
|
285
|
+
*/
|
286
|
+
getTagNamespace: noop,
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Parse the real tag name for the specific platform.
|
290
|
+
*/
|
291
|
+
parsePlatformTagName: identity,
|
292
|
+
|
293
|
+
/**
|
294
|
+
* Check if an attribute must be bound using property, e.g. value
|
295
|
+
* Platform-dependent.
|
296
|
+
*/
|
297
|
+
mustUseProp: no,
|
298
|
+
|
299
|
+
/**
|
300
|
+
* List of asset types that a component can own.
|
301
|
+
*/
|
302
|
+
_assetTypes: [
|
303
|
+
'component',
|
304
|
+
'directive',
|
305
|
+
'filter'
|
306
|
+
],
|
307
|
+
|
308
|
+
/**
|
309
|
+
* List of lifecycle hooks.
|
310
|
+
*/
|
311
|
+
_lifecycleHooks: [
|
312
|
+
'beforeCreate',
|
313
|
+
'created',
|
314
|
+
'beforeMount',
|
315
|
+
'mounted',
|
316
|
+
'beforeUpdate',
|
317
|
+
'updated',
|
318
|
+
'beforeDestroy',
|
319
|
+
'destroyed',
|
320
|
+
'activated',
|
321
|
+
'deactivated'
|
322
|
+
],
|
323
|
+
|
324
|
+
/**
|
325
|
+
* Max circular updates allowed in a scheduler flush cycle.
|
326
|
+
*/
|
327
|
+
_maxUpdateCount: 100
|
328
|
+
};
|
329
|
+
|
330
|
+
/* */
|
331
|
+
|
235
332
|
/**
|
236
333
|
* Check if a string starts with $ or _
|
237
334
|
*/
|
@@ -278,10 +375,7 @@ function parsePath (path) {
|
|
278
375
|
var hasProto = '__proto__' in {};
|
279
376
|
|
280
377
|
// Browser environment sniffing
|
281
|
-
var inBrowser =
|
282
|
-
typeof window !== 'undefined' &&
|
283
|
-
Object.prototype.toString.call(window) !== '[object Object]';
|
284
|
-
|
378
|
+
var inBrowser = typeof window !== 'undefined';
|
285
379
|
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
286
380
|
var isIE = UA && /msie|trident/.test(UA);
|
287
381
|
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
@@ -340,8 +434,9 @@ var nextTick = (function () {
|
|
340
434
|
/* istanbul ignore if */
|
341
435
|
if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
342
436
|
var p = Promise.resolve();
|
437
|
+
var logError = function (err) { console.error(err); };
|
343
438
|
timerFunc = function () {
|
344
|
-
p.then(nextTickHandler);
|
439
|
+
p.then(nextTickHandler).catch(logError);
|
345
440
|
// in problematic UIWebViews, Promise.then doesn't completely break, but
|
346
441
|
// it can get stuck in a weird state where callbacks are pushed into the
|
347
442
|
// microtask queue but the queue isn't being flushed, until the browser
|
@@ -404,10 +499,10 @@ if (typeof Set !== 'undefined' && isNative(Set)) {
|
|
404
499
|
this.set = Object.create(null);
|
405
500
|
}
|
406
501
|
Set.prototype.has = function has (key) {
|
407
|
-
return this.set[key]
|
502
|
+
return this.set[key] === true
|
408
503
|
};
|
409
504
|
Set.prototype.add = function add (key) {
|
410
|
-
this.set[key] =
|
505
|
+
this.set[key] = true;
|
411
506
|
};
|
412
507
|
Set.prototype.clear = function clear () {
|
413
508
|
this.set = Object.create(null);
|
@@ -417,93 +512,6 @@ if (typeof Set !== 'undefined' && isNative(Set)) {
|
|
417
512
|
}());
|
418
513
|
}
|
419
514
|
|
420
|
-
/* */
|
421
|
-
|
422
|
-
var config = {
|
423
|
-
/**
|
424
|
-
* Option merge strategies (used in core/util/options)
|
425
|
-
*/
|
426
|
-
optionMergeStrategies: Object.create(null),
|
427
|
-
|
428
|
-
/**
|
429
|
-
* Whether to suppress warnings.
|
430
|
-
*/
|
431
|
-
silent: false,
|
432
|
-
|
433
|
-
/**
|
434
|
-
* Whether to enable devtools
|
435
|
-
*/
|
436
|
-
devtools: "development" !== 'production',
|
437
|
-
|
438
|
-
/**
|
439
|
-
* Error handler for watcher errors
|
440
|
-
*/
|
441
|
-
errorHandler: null,
|
442
|
-
|
443
|
-
/**
|
444
|
-
* Ignore certain custom elements
|
445
|
-
*/
|
446
|
-
ignoredElements: null,
|
447
|
-
|
448
|
-
/**
|
449
|
-
* Custom user key aliases for v-on
|
450
|
-
*/
|
451
|
-
keyCodes: Object.create(null),
|
452
|
-
|
453
|
-
/**
|
454
|
-
* Check if a tag is reserved so that it cannot be registered as a
|
455
|
-
* component. This is platform-dependent and may be overwritten.
|
456
|
-
*/
|
457
|
-
isReservedTag: no,
|
458
|
-
|
459
|
-
/**
|
460
|
-
* Check if a tag is an unknown element.
|
461
|
-
* Platform-dependent.
|
462
|
-
*/
|
463
|
-
isUnknownElement: no,
|
464
|
-
|
465
|
-
/**
|
466
|
-
* Get the namespace of an element
|
467
|
-
*/
|
468
|
-
getTagNamespace: noop,
|
469
|
-
|
470
|
-
/**
|
471
|
-
* Check if an attribute must be bound using property, e.g. value
|
472
|
-
* Platform-dependent.
|
473
|
-
*/
|
474
|
-
mustUseProp: no,
|
475
|
-
|
476
|
-
/**
|
477
|
-
* List of asset types that a component can own.
|
478
|
-
*/
|
479
|
-
_assetTypes: [
|
480
|
-
'component',
|
481
|
-
'directive',
|
482
|
-
'filter'
|
483
|
-
],
|
484
|
-
|
485
|
-
/**
|
486
|
-
* List of lifecycle hooks.
|
487
|
-
*/
|
488
|
-
_lifecycleHooks: [
|
489
|
-
'beforeCreate',
|
490
|
-
'created',
|
491
|
-
'beforeMount',
|
492
|
-
'mounted',
|
493
|
-
'beforeUpdate',
|
494
|
-
'updated',
|
495
|
-
'beforeDestroy',
|
496
|
-
'destroyed',
|
497
|
-
'activated',
|
498
|
-
'deactivated'
|
499
|
-
],
|
500
|
-
|
501
|
-
/**
|
502
|
-
* Max circular updates allowed in a scheduler flush cycle.
|
503
|
-
*/
|
504
|
-
_maxUpdateCount: 100
|
505
|
-
};
|
506
|
-
|
507
515
|
var warn = noop;
|
508
516
|
var formatComponentName;
|
509
517
|
|
@@ -712,9 +720,8 @@ function protoAugment (target, src) {
|
|
712
720
|
/**
|
713
721
|
* Augment an target Object or Array by defining
|
714
722
|
* hidden properties.
|
715
|
-
*
|
716
|
-
* istanbul ignore next
|
717
723
|
*/
|
724
|
+
/* istanbul ignore next */
|
718
725
|
function copyAugment (target, src, keys) {
|
719
726
|
for (var i = 0, l = keys.length; i < l; i++) {
|
720
727
|
var key = keys[i];
|
@@ -809,7 +816,7 @@ function defineReactive$$1 (
|
|
809
816
|
* triggers change notification if the property doesn't
|
810
817
|
* already exist.
|
811
818
|
*/
|
812
|
-
function set (obj, key, val) {
|
819
|
+
function set$1 (obj, key, val) {
|
813
820
|
if (Array.isArray(obj)) {
|
814
821
|
obj.length = Math.max(obj.length, key);
|
815
822
|
obj.splice(key, 1, val);
|
@@ -908,7 +915,7 @@ function mergeData (to, from) {
|
|
908
915
|
toVal = to[key];
|
909
916
|
fromVal = from[key];
|
910
917
|
if (!hasOwn(to, key)) {
|
911
|
-
set(to, key, fromVal);
|
918
|
+
set$1(to, key, fromVal);
|
912
919
|
} else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
|
913
920
|
mergeData(toVal, fromVal);
|
914
921
|
}
|
@@ -1180,11 +1187,14 @@ function resolveAsset (
|
|
1180
1187
|
return
|
1181
1188
|
}
|
1182
1189
|
var assets = options[type];
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1190
|
+
// check local registration variations first
|
1191
|
+
if (hasOwn(assets, id)) { return assets[id] }
|
1192
|
+
var camelizedId = camelize(id);
|
1193
|
+
if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
|
1194
|
+
var PascalCaseId = capitalize(camelizedId);
|
1195
|
+
if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
|
1196
|
+
// fallback to prototype chain
|
1197
|
+
var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
|
1188
1198
|
if ("development" !== 'production' && warnMissing && !res) {
|
1189
1199
|
warn(
|
1190
1200
|
'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
|
@@ -1386,6 +1396,7 @@ var util = Object.freeze({
|
|
1386
1396
|
toObject: toObject,
|
1387
1397
|
noop: noop,
|
1388
1398
|
no: no,
|
1399
|
+
identity: identity,
|
1389
1400
|
genStaticKeys: genStaticKeys,
|
1390
1401
|
looseEqual: looseEqual,
|
1391
1402
|
looseIndexOf: looseIndexOf,
|
@@ -1436,6 +1447,21 @@ var initProxy;
|
|
1436
1447
|
typeof Proxy !== 'undefined' &&
|
1437
1448
|
Proxy.toString().match(/native code/);
|
1438
1449
|
|
1450
|
+
if (hasProxy) {
|
1451
|
+
var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
|
1452
|
+
config.keyCodes = new Proxy(config.keyCodes, {
|
1453
|
+
set: function set (target, key, value) {
|
1454
|
+
if (isBuiltInModifier(key)) {
|
1455
|
+
warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
|
1456
|
+
return false
|
1457
|
+
} else {
|
1458
|
+
target[key] = value;
|
1459
|
+
return true
|
1460
|
+
}
|
1461
|
+
}
|
1462
|
+
});
|
1463
|
+
}
|
1464
|
+
|
1439
1465
|
var hasHandler = {
|
1440
1466
|
has: function has (target, key) {
|
1441
1467
|
var has = key in target;
|
@@ -1712,14 +1738,14 @@ Watcher.prototype.run = function run () {
|
|
1712
1738
|
try {
|
1713
1739
|
this.cb.call(this.vm, value, oldValue);
|
1714
1740
|
} catch (e) {
|
1715
|
-
"development" !== 'production' && warn(
|
1716
|
-
("Error in watcher \"" + (this.expression) + "\""),
|
1717
|
-
this.vm
|
1718
|
-
);
|
1719
1741
|
/* istanbul ignore else */
|
1720
1742
|
if (config.errorHandler) {
|
1721
1743
|
config.errorHandler.call(null, e, this.vm);
|
1722
1744
|
} else {
|
1745
|
+
"development" !== 'production' && warn(
|
1746
|
+
("Error in watcher \"" + (this.expression) + "\""),
|
1747
|
+
this.vm
|
1748
|
+
);
|
1723
1749
|
throw e
|
1724
1750
|
}
|
1725
1751
|
}
|
@@ -1812,13 +1838,13 @@ function _traverse (val, seen) {
|
|
1812
1838
|
function initState (vm) {
|
1813
1839
|
vm._watchers = [];
|
1814
1840
|
initProps(vm);
|
1841
|
+
initMethods(vm);
|
1815
1842
|
initData(vm);
|
1816
1843
|
initComputed(vm);
|
1817
|
-
initMethods(vm);
|
1818
1844
|
initWatch(vm);
|
1819
1845
|
}
|
1820
1846
|
|
1821
|
-
var isReservedProp =
|
1847
|
+
var isReservedProp = { key: 1, ref: 1, slot: 1 };
|
1822
1848
|
|
1823
1849
|
function initProps (vm) {
|
1824
1850
|
var props = vm.$options.props;
|
@@ -1832,7 +1858,7 @@ function initProps (vm) {
|
|
1832
1858
|
var key = keys[i];
|
1833
1859
|
/* istanbul ignore else */
|
1834
1860
|
{
|
1835
|
-
if (isReservedProp
|
1861
|
+
if (isReservedProp[key]) {
|
1836
1862
|
warn(
|
1837
1863
|
("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
|
1838
1864
|
vm
|
@@ -1865,7 +1891,8 @@ function initData (vm) {
|
|
1865
1891
|
if (!isPlainObject(data)) {
|
1866
1892
|
data = {};
|
1867
1893
|
"development" !== 'production' && warn(
|
1868
|
-
'data functions should return an object
|
1894
|
+
'data functions should return an object:\n' +
|
1895
|
+
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
1869
1896
|
vm
|
1870
1897
|
);
|
1871
1898
|
}
|
@@ -1997,7 +2024,7 @@ function stateMixin (Vue) {
|
|
1997
2024
|
}
|
1998
2025
|
Object.defineProperty(Vue.prototype, '$data', dataDef);
|
1999
2026
|
|
2000
|
-
Vue.prototype.$set = set;
|
2027
|
+
Vue.prototype.$set = set$1;
|
2001
2028
|
Vue.prototype.$delete = del;
|
2002
2029
|
|
2003
2030
|
Vue.prototype.$watch = function (
|
@@ -2041,7 +2068,6 @@ var VNode = function VNode (
|
|
2041
2068
|
children,
|
2042
2069
|
text,
|
2043
2070
|
elm,
|
2044
|
-
ns,
|
2045
2071
|
context,
|
2046
2072
|
componentOptions
|
2047
2073
|
) {
|
@@ -2050,7 +2076,7 @@ var VNode = function VNode (
|
|
2050
2076
|
this.children = children;
|
2051
2077
|
this.text = text;
|
2052
2078
|
this.elm = elm;
|
2053
|
-
this.ns =
|
2079
|
+
this.ns = undefined;
|
2054
2080
|
this.context = context;
|
2055
2081
|
this.functionalContext = undefined;
|
2056
2082
|
this.key = data && data.key;
|
@@ -2065,13 +2091,17 @@ var VNode = function VNode (
|
|
2065
2091
|
this.isOnce = false;
|
2066
2092
|
};
|
2067
2093
|
|
2068
|
-
var
|
2094
|
+
var createEmptyVNode = function () {
|
2069
2095
|
var node = new VNode();
|
2070
2096
|
node.text = '';
|
2071
2097
|
node.isComment = true;
|
2072
2098
|
return node
|
2073
2099
|
};
|
2074
2100
|
|
2101
|
+
function createTextVNode (val) {
|
2102
|
+
return new VNode(undefined, undefined, undefined, String(val))
|
2103
|
+
}
|
2104
|
+
|
2075
2105
|
// optimized shallow clone
|
2076
2106
|
// used for static nodes and slot nodes because they may be reused across
|
2077
2107
|
// multiple renders, cloning them avoids errors when DOM manipulations rely
|
@@ -2083,10 +2113,10 @@ function cloneVNode (vnode) {
|
|
2083
2113
|
vnode.children,
|
2084
2114
|
vnode.text,
|
2085
2115
|
vnode.elm,
|
2086
|
-
vnode.ns,
|
2087
2116
|
vnode.context,
|
2088
2117
|
vnode.componentOptions
|
2089
2118
|
);
|
2119
|
+
cloned.ns = vnode.ns;
|
2090
2120
|
cloned.isStatic = vnode.isStatic;
|
2091
2121
|
cloned.key = vnode.key;
|
2092
2122
|
cloned.isCloned = true;
|
@@ -2103,162 +2133,6 @@ function cloneVNodes (vnodes) {
|
|
2103
2133
|
|
2104
2134
|
/* */
|
2105
2135
|
|
2106
|
-
function mergeVNodeHook (def, hookKey, hook, key) {
|
2107
|
-
key = key + hookKey;
|
2108
|
-
var injectedHash = def.__injected || (def.__injected = {});
|
2109
|
-
if (!injectedHash[key]) {
|
2110
|
-
injectedHash[key] = true;
|
2111
|
-
var oldHook = def[hookKey];
|
2112
|
-
if (oldHook) {
|
2113
|
-
def[hookKey] = function () {
|
2114
|
-
oldHook.apply(this, arguments);
|
2115
|
-
hook.apply(this, arguments);
|
2116
|
-
};
|
2117
|
-
} else {
|
2118
|
-
def[hookKey] = hook;
|
2119
|
-
}
|
2120
|
-
}
|
2121
|
-
}
|
2122
|
-
|
2123
|
-
/* */
|
2124
|
-
|
2125
|
-
function updateListeners (
|
2126
|
-
on,
|
2127
|
-
oldOn,
|
2128
|
-
add,
|
2129
|
-
remove$$1,
|
2130
|
-
vm
|
2131
|
-
) {
|
2132
|
-
var name, cur, old, fn, event, capture;
|
2133
|
-
for (name in on) {
|
2134
|
-
cur = on[name];
|
2135
|
-
old = oldOn[name];
|
2136
|
-
if (!cur) {
|
2137
|
-
"development" !== 'production' && warn(
|
2138
|
-
"Invalid handler for event \"" + name + "\": got " + String(cur),
|
2139
|
-
vm
|
2140
|
-
);
|
2141
|
-
} else if (!old) {
|
2142
|
-
capture = name.charAt(0) === '!';
|
2143
|
-
event = capture ? name.slice(1) : name;
|
2144
|
-
if (Array.isArray(cur)) {
|
2145
|
-
add(event, (cur.invoker = arrInvoker(cur)), capture);
|
2146
|
-
} else {
|
2147
|
-
if (!cur.invoker) {
|
2148
|
-
fn = cur;
|
2149
|
-
cur = on[name] = {};
|
2150
|
-
cur.fn = fn;
|
2151
|
-
cur.invoker = fnInvoker(cur);
|
2152
|
-
}
|
2153
|
-
add(event, cur.invoker, capture);
|
2154
|
-
}
|
2155
|
-
} else if (cur !== old) {
|
2156
|
-
if (Array.isArray(old)) {
|
2157
|
-
old.length = cur.length;
|
2158
|
-
for (var i = 0; i < old.length; i++) { old[i] = cur[i]; }
|
2159
|
-
on[name] = old;
|
2160
|
-
} else {
|
2161
|
-
old.fn = cur;
|
2162
|
-
on[name] = old;
|
2163
|
-
}
|
2164
|
-
}
|
2165
|
-
}
|
2166
|
-
for (name in oldOn) {
|
2167
|
-
if (!on[name]) {
|
2168
|
-
event = name.charAt(0) === '!' ? name.slice(1) : name;
|
2169
|
-
remove$$1(event, oldOn[name].invoker);
|
2170
|
-
}
|
2171
|
-
}
|
2172
|
-
}
|
2173
|
-
|
2174
|
-
function arrInvoker (arr) {
|
2175
|
-
return function (ev) {
|
2176
|
-
var arguments$1 = arguments;
|
2177
|
-
|
2178
|
-
var single = arguments.length === 1;
|
2179
|
-
for (var i = 0; i < arr.length; i++) {
|
2180
|
-
single ? arr[i](ev) : arr[i].apply(null, arguments$1);
|
2181
|
-
}
|
2182
|
-
}
|
2183
|
-
}
|
2184
|
-
|
2185
|
-
function fnInvoker (o) {
|
2186
|
-
return function (ev) {
|
2187
|
-
var single = arguments.length === 1;
|
2188
|
-
single ? o.fn(ev) : o.fn.apply(null, arguments);
|
2189
|
-
}
|
2190
|
-
}
|
2191
|
-
|
2192
|
-
/* */
|
2193
|
-
|
2194
|
-
function normalizeChildren (
|
2195
|
-
children,
|
2196
|
-
ns,
|
2197
|
-
nestedIndex
|
2198
|
-
) {
|
2199
|
-
if (isPrimitive(children)) {
|
2200
|
-
return [createTextVNode(children)]
|
2201
|
-
}
|
2202
|
-
if (Array.isArray(children)) {
|
2203
|
-
var res = [];
|
2204
|
-
for (var i = 0, l = children.length; i < l; i++) {
|
2205
|
-
var c = children[i];
|
2206
|
-
var last = res[res.length - 1];
|
2207
|
-
// nested
|
2208
|
-
if (Array.isArray(c)) {
|
2209
|
-
res.push.apply(res, normalizeChildren(c, ns, ((nestedIndex || '') + "_" + i)));
|
2210
|
-
} else if (isPrimitive(c)) {
|
2211
|
-
if (last && last.text) {
|
2212
|
-
last.text += String(c);
|
2213
|
-
} else if (c !== '') {
|
2214
|
-
// convert primitive to vnode
|
2215
|
-
res.push(createTextVNode(c));
|
2216
|
-
}
|
2217
|
-
} else if (c instanceof VNode) {
|
2218
|
-
if (c.text && last && last.text) {
|
2219
|
-
if (!last.isCloned) {
|
2220
|
-
last.text += c.text;
|
2221
|
-
}
|
2222
|
-
} else {
|
2223
|
-
// inherit parent namespace
|
2224
|
-
if (ns) {
|
2225
|
-
applyNS(c, ns);
|
2226
|
-
}
|
2227
|
-
// default key for nested array children (likely generated by v-for)
|
2228
|
-
if (c.tag && c.key == null && nestedIndex != null) {
|
2229
|
-
c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2230
|
-
}
|
2231
|
-
res.push(c);
|
2232
|
-
}
|
2233
|
-
}
|
2234
|
-
}
|
2235
|
-
return res
|
2236
|
-
}
|
2237
|
-
}
|
2238
|
-
|
2239
|
-
function createTextVNode (val) {
|
2240
|
-
return new VNode(undefined, undefined, undefined, String(val))
|
2241
|
-
}
|
2242
|
-
|
2243
|
-
function applyNS (vnode, ns) {
|
2244
|
-
if (vnode.tag && !vnode.ns) {
|
2245
|
-
vnode.ns = ns;
|
2246
|
-
if (vnode.children) {
|
2247
|
-
for (var i = 0, l = vnode.children.length; i < l; i++) {
|
2248
|
-
applyNS(vnode.children[i], ns);
|
2249
|
-
}
|
2250
|
-
}
|
2251
|
-
}
|
2252
|
-
}
|
2253
|
-
|
2254
|
-
/* */
|
2255
|
-
|
2256
|
-
function getFirstComponentChild (children) {
|
2257
|
-
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
|
2258
|
-
}
|
2259
|
-
|
2260
|
-
/* */
|
2261
|
-
|
2262
2136
|
var activeInstance = null;
|
2263
2137
|
|
2264
2138
|
function initLifecycle (vm) {
|
@@ -2294,7 +2168,7 @@ function lifecycleMixin (Vue) {
|
|
2294
2168
|
var vm = this;
|
2295
2169
|
vm.$el = el;
|
2296
2170
|
if (!vm.$options.render) {
|
2297
|
-
vm.$options.render =
|
2171
|
+
vm.$options.render = createEmptyVNode;
|
2298
2172
|
{
|
2299
2173
|
/* istanbul ignore if */
|
2300
2174
|
if (vm.$options.template && vm.$options.template.charAt(0) !== '#') {
|
@@ -2332,15 +2206,21 @@ function lifecycleMixin (Vue) {
|
|
2332
2206
|
callHook(vm, 'beforeUpdate');
|
2333
2207
|
}
|
2334
2208
|
var prevEl = vm.$el;
|
2209
|
+
var prevVnode = vm._vnode;
|
2335
2210
|
var prevActiveInstance = activeInstance;
|
2336
2211
|
activeInstance = vm;
|
2337
|
-
var prevVnode = vm._vnode;
|
2338
2212
|
vm._vnode = vnode;
|
2213
|
+
// Vue.prototype.__patch__ is injected in entry points
|
2214
|
+
// based on the rendering backend used.
|
2339
2215
|
if (!prevVnode) {
|
2340
|
-
//
|
2341
|
-
|
2342
|
-
|
2216
|
+
// initial render
|
2217
|
+
vm.$el = vm.__patch__(
|
2218
|
+
vm.$el, vnode, hydrating, false /* removeOnly */,
|
2219
|
+
vm.$options._parentElm,
|
2220
|
+
vm.$options._refElm
|
2221
|
+
);
|
2343
2222
|
} else {
|
2223
|
+
// updates
|
2344
2224
|
vm.$el = vm.__patch__(prevVnode, vnode);
|
2345
2225
|
}
|
2346
2226
|
activeInstance = prevActiveInstance;
|
@@ -2399,7 +2279,7 @@ function lifecycleMixin (Vue) {
|
|
2399
2279
|
}
|
2400
2280
|
// resolve slots + force update if has children
|
2401
2281
|
if (hasChildren) {
|
2402
|
-
vm.$slots = resolveSlots(renderChildren,
|
2282
|
+
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
2403
2283
|
vm.$forceUpdate();
|
2404
2284
|
}
|
2405
2285
|
};
|
@@ -2539,7 +2419,7 @@ function createComponent (
|
|
2539
2419
|
var name = Ctor.options.name || tag;
|
2540
2420
|
var vnode = new VNode(
|
2541
2421
|
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
2542
|
-
data, undefined, undefined, undefined,
|
2422
|
+
data, undefined, undefined, undefined, context,
|
2543
2423
|
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
|
2544
2424
|
);
|
2545
2425
|
return vnode
|
@@ -2559,19 +2439,17 @@ function createFunctionalComponent (
|
|
2559
2439
|
props[key] = validateProp(key, propOptions, propsData);
|
2560
2440
|
}
|
2561
2441
|
}
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
}
|
2574
|
-
);
|
2442
|
+
// ensure the createElement function in functional components
|
2443
|
+
// gets a unique context - this is necessary for correct named slot check
|
2444
|
+
var _context = Object.create(context);
|
2445
|
+
var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
|
2446
|
+
var vnode = Ctor.options.render.call(null, h, {
|
2447
|
+
props: props,
|
2448
|
+
data: data,
|
2449
|
+
parent: context,
|
2450
|
+
children: children,
|
2451
|
+
slots: function () { return resolveSlots(children, context); }
|
2452
|
+
});
|
2575
2453
|
if (vnode instanceof VNode) {
|
2576
2454
|
vnode.functionalContext = context;
|
2577
2455
|
if (data.slot) {
|
@@ -2583,7 +2461,9 @@ function createFunctionalComponent (
|
|
2583
2461
|
|
2584
2462
|
function createComponentInstanceForVnode (
|
2585
2463
|
vnode, // we know it's MountedComponentVNode but flow doesn't
|
2586
|
-
parent // activeInstance in lifecycle state
|
2464
|
+
parent, // activeInstance in lifecycle state
|
2465
|
+
parentElm,
|
2466
|
+
refElm
|
2587
2467
|
) {
|
2588
2468
|
var vnodeComponentOptions = vnode.componentOptions;
|
2589
2469
|
var options = {
|
@@ -2593,7 +2473,9 @@ function createComponentInstanceForVnode (
|
|
2593
2473
|
_componentTag: vnodeComponentOptions.tag,
|
2594
2474
|
_parentVnode: vnode,
|
2595
2475
|
_parentListeners: vnodeComponentOptions.listeners,
|
2596
|
-
_renderChildren: vnodeComponentOptions.children
|
2476
|
+
_renderChildren: vnodeComponentOptions.children,
|
2477
|
+
_parentElm: parentElm || null,
|
2478
|
+
_refElm: refElm || null
|
2597
2479
|
};
|
2598
2480
|
// check inline-template render functions
|
2599
2481
|
var inlineTemplate = vnode.data.inlineTemplate;
|
@@ -2604,9 +2486,19 @@ function createComponentInstanceForVnode (
|
|
2604
2486
|
return new vnodeComponentOptions.Ctor(options)
|
2605
2487
|
}
|
2606
2488
|
|
2607
|
-
function init (
|
2489
|
+
function init (
|
2490
|
+
vnode,
|
2491
|
+
hydrating,
|
2492
|
+
parentElm,
|
2493
|
+
refElm
|
2494
|
+
) {
|
2608
2495
|
if (!vnode.child || vnode.child._isDestroyed) {
|
2609
|
-
var child = vnode.child = createComponentInstanceForVnode(
|
2496
|
+
var child = vnode.child = createComponentInstanceForVnode(
|
2497
|
+
vnode,
|
2498
|
+
activeInstance,
|
2499
|
+
parentElm,
|
2500
|
+
refElm
|
2501
|
+
);
|
2610
2502
|
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
2611
2503
|
} else if (vnode.data.keepAlive) {
|
2612
2504
|
// kept-alive components, treat as a patch
|
@@ -2722,50 +2614,189 @@ function extractProps (data, Ctor) {
|
|
2722
2614
|
return res
|
2723
2615
|
}
|
2724
2616
|
|
2725
|
-
function checkProp (
|
2726
|
-
res,
|
2727
|
-
hash,
|
2728
|
-
key,
|
2729
|
-
altKey,
|
2730
|
-
preserve
|
2731
|
-
) {
|
2732
|
-
if (hash) {
|
2733
|
-
if (hasOwn(hash, key)) {
|
2734
|
-
res[key] = hash[key];
|
2735
|
-
if (!preserve) {
|
2736
|
-
delete hash[key];
|
2617
|
+
function checkProp (
|
2618
|
+
res,
|
2619
|
+
hash,
|
2620
|
+
key,
|
2621
|
+
altKey,
|
2622
|
+
preserve
|
2623
|
+
) {
|
2624
|
+
if (hash) {
|
2625
|
+
if (hasOwn(hash, key)) {
|
2626
|
+
res[key] = hash[key];
|
2627
|
+
if (!preserve) {
|
2628
|
+
delete hash[key];
|
2629
|
+
}
|
2630
|
+
return true
|
2631
|
+
} else if (hasOwn(hash, altKey)) {
|
2632
|
+
res[key] = hash[altKey];
|
2633
|
+
if (!preserve) {
|
2634
|
+
delete hash[altKey];
|
2635
|
+
}
|
2636
|
+
return true
|
2637
|
+
}
|
2638
|
+
}
|
2639
|
+
return false
|
2640
|
+
}
|
2641
|
+
|
2642
|
+
function mergeHooks (data) {
|
2643
|
+
if (!data.hook) {
|
2644
|
+
data.hook = {};
|
2645
|
+
}
|
2646
|
+
for (var i = 0; i < hooksToMerge.length; i++) {
|
2647
|
+
var key = hooksToMerge[i];
|
2648
|
+
var fromParent = data.hook[key];
|
2649
|
+
var ours = hooks[key];
|
2650
|
+
data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
|
2651
|
+
}
|
2652
|
+
}
|
2653
|
+
|
2654
|
+
function mergeHook$1 (one, two) {
|
2655
|
+
return function (a, b, c, d) {
|
2656
|
+
one(a, b, c, d);
|
2657
|
+
two(a, b, c, d);
|
2658
|
+
}
|
2659
|
+
}
|
2660
|
+
|
2661
|
+
/* */
|
2662
|
+
|
2663
|
+
function mergeVNodeHook (def, hookKey, hook, key) {
|
2664
|
+
key = key + hookKey;
|
2665
|
+
var injectedHash = def.__injected || (def.__injected = {});
|
2666
|
+
if (!injectedHash[key]) {
|
2667
|
+
injectedHash[key] = true;
|
2668
|
+
var oldHook = def[hookKey];
|
2669
|
+
if (oldHook) {
|
2670
|
+
def[hookKey] = function () {
|
2671
|
+
oldHook.apply(this, arguments);
|
2672
|
+
hook.apply(this, arguments);
|
2673
|
+
};
|
2674
|
+
} else {
|
2675
|
+
def[hookKey] = hook;
|
2676
|
+
}
|
2677
|
+
}
|
2678
|
+
}
|
2679
|
+
|
2680
|
+
/* */
|
2681
|
+
|
2682
|
+
function updateListeners (
|
2683
|
+
on,
|
2684
|
+
oldOn,
|
2685
|
+
add,
|
2686
|
+
remove$$1,
|
2687
|
+
vm
|
2688
|
+
) {
|
2689
|
+
var name, cur, old, fn, event, capture, once;
|
2690
|
+
for (name in on) {
|
2691
|
+
cur = on[name];
|
2692
|
+
old = oldOn[name];
|
2693
|
+
if (!cur) {
|
2694
|
+
"development" !== 'production' && warn(
|
2695
|
+
"Invalid handler for event \"" + name + "\": got " + String(cur),
|
2696
|
+
vm
|
2697
|
+
);
|
2698
|
+
} else if (!old) {
|
2699
|
+
once = name.charAt(0) === '~'; // Prefixed last, checked first
|
2700
|
+
event = once ? name.slice(1) : name;
|
2701
|
+
capture = event.charAt(0) === '!';
|
2702
|
+
event = capture ? event.slice(1) : event;
|
2703
|
+
if (Array.isArray(cur)) {
|
2704
|
+
add(event, (cur.invoker = arrInvoker(cur)), once, capture);
|
2705
|
+
} else {
|
2706
|
+
if (!cur.invoker) {
|
2707
|
+
fn = cur;
|
2708
|
+
cur = on[name] = {};
|
2709
|
+
cur.fn = fn;
|
2710
|
+
cur.invoker = fnInvoker(cur);
|
2711
|
+
}
|
2712
|
+
add(event, cur.invoker, once, capture);
|
2713
|
+
}
|
2714
|
+
} else if (cur !== old) {
|
2715
|
+
if (Array.isArray(old)) {
|
2716
|
+
old.length = cur.length;
|
2717
|
+
for (var i = 0; i < old.length; i++) { old[i] = cur[i]; }
|
2718
|
+
on[name] = old;
|
2719
|
+
} else {
|
2720
|
+
old.fn = cur;
|
2721
|
+
on[name] = old;
|
2722
|
+
}
|
2723
|
+
}
|
2724
|
+
}
|
2725
|
+
for (name in oldOn) {
|
2726
|
+
if (!on[name]) {
|
2727
|
+
once = name.charAt(0) === '~'; // Prefixed last, checked first
|
2728
|
+
event = once ? name.slice(1) : name;
|
2729
|
+
capture = event.charAt(0) === '!';
|
2730
|
+
event = capture ? event.slice(1) : event;
|
2731
|
+
remove$$1(event, oldOn[name].invoker, capture);
|
2732
|
+
}
|
2733
|
+
}
|
2734
|
+
}
|
2735
|
+
|
2736
|
+
function arrInvoker (arr) {
|
2737
|
+
return function (ev) {
|
2738
|
+
var arguments$1 = arguments;
|
2739
|
+
|
2740
|
+
var single = arguments.length === 1;
|
2741
|
+
for (var i = 0; i < arr.length; i++) {
|
2742
|
+
single ? arr[i](ev) : arr[i].apply(null, arguments$1);
|
2743
|
+
}
|
2744
|
+
}
|
2745
|
+
}
|
2746
|
+
|
2747
|
+
function fnInvoker (o) {
|
2748
|
+
return function (ev) {
|
2749
|
+
var single = arguments.length === 1;
|
2750
|
+
single ? o.fn(ev) : o.fn.apply(null, arguments);
|
2751
|
+
}
|
2752
|
+
}
|
2753
|
+
|
2754
|
+
/* */
|
2755
|
+
|
2756
|
+
function normalizeChildren (children) {
|
2757
|
+
return isPrimitive(children)
|
2758
|
+
? [createTextVNode(children)]
|
2759
|
+
: Array.isArray(children)
|
2760
|
+
? normalizeArrayChildren(children)
|
2761
|
+
: undefined
|
2762
|
+
}
|
2763
|
+
|
2764
|
+
function normalizeArrayChildren (children, nestedIndex) {
|
2765
|
+
var res = [];
|
2766
|
+
var i, c, last;
|
2767
|
+
for (i = 0; i < children.length; i++) {
|
2768
|
+
c = children[i];
|
2769
|
+
if (c == null || typeof c === 'boolean') { continue }
|
2770
|
+
last = res[res.length - 1];
|
2771
|
+
// nested
|
2772
|
+
if (Array.isArray(c)) {
|
2773
|
+
res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
|
2774
|
+
} else if (isPrimitive(c)) {
|
2775
|
+
if (last && last.text) {
|
2776
|
+
last.text += String(c);
|
2777
|
+
} else if (c !== '') {
|
2778
|
+
// convert primitive to vnode
|
2779
|
+
res.push(createTextVNode(c));
|
2737
2780
|
}
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2781
|
+
} else {
|
2782
|
+
if (c.text && last && last.text) {
|
2783
|
+
res[res.length - 1] = createTextVNode(last.text + c.text);
|
2784
|
+
} else {
|
2785
|
+
// default key for nested array children (likely generated by v-for)
|
2786
|
+
if (c.tag && c.key == null && nestedIndex != null) {
|
2787
|
+
c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2788
|
+
}
|
2789
|
+
res.push(c);
|
2743
2790
|
}
|
2744
|
-
return true
|
2745
2791
|
}
|
2746
2792
|
}
|
2747
|
-
return
|
2793
|
+
return res
|
2748
2794
|
}
|
2749
2795
|
|
2750
|
-
|
2751
|
-
if (!data.hook) {
|
2752
|
-
data.hook = {};
|
2753
|
-
}
|
2754
|
-
for (var i = 0; i < hooksToMerge.length; i++) {
|
2755
|
-
var key = hooksToMerge[i];
|
2756
|
-
var fromParent = data.hook[key];
|
2757
|
-
var ours = hooks[key];
|
2758
|
-
data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
|
2759
|
-
}
|
2760
|
-
}
|
2796
|
+
/* */
|
2761
2797
|
|
2762
|
-
function
|
2763
|
-
|
2764
|
-
// to avoid having to use fn.apply().
|
2765
|
-
return function (_, __) {
|
2766
|
-
a(_, __);
|
2767
|
-
b(_, __);
|
2768
|
-
}
|
2798
|
+
function getFirstComponentChild (children) {
|
2799
|
+
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
|
2769
2800
|
}
|
2770
2801
|
|
2771
2802
|
/* */
|
@@ -2773,23 +2804,28 @@ function mergeHook$1 (a, b) {
|
|
2773
2804
|
// wrapper function for providing a more flexible interface
|
2774
2805
|
// without getting yelled at by flow
|
2775
2806
|
function createElement (
|
2807
|
+
context,
|
2776
2808
|
tag,
|
2777
2809
|
data,
|
2778
|
-
children
|
2810
|
+
children,
|
2811
|
+
needNormalization,
|
2812
|
+
alwaysNormalize
|
2779
2813
|
) {
|
2780
|
-
if (
|
2814
|
+
if (Array.isArray(data) || isPrimitive(data)) {
|
2815
|
+
needNormalization = children;
|
2781
2816
|
children = data;
|
2782
2817
|
data = undefined;
|
2783
2818
|
}
|
2784
|
-
|
2785
|
-
return _createElement(
|
2819
|
+
if (alwaysNormalize) { needNormalization = true; }
|
2820
|
+
return _createElement(context, tag, data, children, needNormalization)
|
2786
2821
|
}
|
2787
2822
|
|
2788
2823
|
function _createElement (
|
2789
2824
|
context,
|
2790
2825
|
tag,
|
2791
2826
|
data,
|
2792
|
-
children
|
2827
|
+
children,
|
2828
|
+
needNormalization
|
2793
2829
|
) {
|
2794
2830
|
if (data && data.__ob__) {
|
2795
2831
|
"development" !== 'production' && warn(
|
@@ -2797,11 +2833,11 @@ function _createElement (
|
|
2797
2833
|
'Always create fresh vnode data objects in each render!',
|
2798
2834
|
context
|
2799
2835
|
);
|
2800
|
-
return
|
2836
|
+
return createEmptyVNode()
|
2801
2837
|
}
|
2802
2838
|
if (!tag) {
|
2803
2839
|
// in case of component :is set to falsy value
|
2804
|
-
return
|
2840
|
+
return createEmptyVNode()
|
2805
2841
|
}
|
2806
2842
|
// support single function children as default scoped slot
|
2807
2843
|
if (Array.isArray(children) &&
|
@@ -2810,31 +2846,53 @@ function _createElement (
|
|
2810
2846
|
data.scopedSlots = { default: children[0] };
|
2811
2847
|
children.length = 0;
|
2812
2848
|
}
|
2849
|
+
if (needNormalization) {
|
2850
|
+
children = normalizeChildren(children);
|
2851
|
+
}
|
2852
|
+
var vnode, ns;
|
2813
2853
|
if (typeof tag === 'string') {
|
2814
2854
|
var Ctor;
|
2815
|
-
|
2855
|
+
ns = config.getTagNamespace(tag);
|
2816
2856
|
if (config.isReservedTag(tag)) {
|
2817
2857
|
// platform built-in elements
|
2818
|
-
|
2819
|
-
tag, data,
|
2820
|
-
undefined, undefined,
|
2821
|
-
)
|
2858
|
+
vnode = new VNode(
|
2859
|
+
config.parsePlatformTagName(tag), data, children,
|
2860
|
+
undefined, undefined, context
|
2861
|
+
);
|
2822
2862
|
} else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
|
2823
2863
|
// component
|
2824
|
-
|
2864
|
+
vnode = createComponent(Ctor, data, context, children, tag);
|
2825
2865
|
} else {
|
2826
2866
|
// unknown or unlisted namespaced elements
|
2827
2867
|
// check at runtime because it may get assigned a namespace when its
|
2828
2868
|
// parent normalizes children
|
2829
|
-
|
2830
|
-
|
2831
|
-
tag, data,
|
2832
|
-
undefined, undefined,
|
2833
|
-
)
|
2869
|
+
ns = tag === 'foreignObject' ? 'xhtml' : ns;
|
2870
|
+
vnode = new VNode(
|
2871
|
+
tag, data, children,
|
2872
|
+
undefined, undefined, context
|
2873
|
+
);
|
2834
2874
|
}
|
2835
2875
|
} else {
|
2836
2876
|
// direct component options / constructor
|
2837
|
-
|
2877
|
+
vnode = createComponent(tag, data, context, children);
|
2878
|
+
}
|
2879
|
+
if (vnode) {
|
2880
|
+
if (ns) { applyNS(vnode, ns); }
|
2881
|
+
return vnode
|
2882
|
+
} else {
|
2883
|
+
return createEmptyVNode()
|
2884
|
+
}
|
2885
|
+
}
|
2886
|
+
|
2887
|
+
function applyNS (vnode, ns) {
|
2888
|
+
vnode.ns = ns;
|
2889
|
+
if (vnode.children) {
|
2890
|
+
for (var i = 0, l = vnode.children.length; i < l; i++) {
|
2891
|
+
var child = vnode.children[i];
|
2892
|
+
if (child.tag && !child.ns) {
|
2893
|
+
applyNS(child, ns);
|
2894
|
+
}
|
2895
|
+
}
|
2838
2896
|
}
|
2839
2897
|
}
|
2840
2898
|
|
@@ -2844,12 +2902,18 @@ function initRender (vm) {
|
|
2844
2902
|
vm.$vnode = null; // the placeholder node in parent tree
|
2845
2903
|
vm._vnode = null; // the root of the child tree
|
2846
2904
|
vm._staticTrees = null;
|
2847
|
-
|
2848
|
-
|
2905
|
+
var parentVnode = vm.$options._parentVnode;
|
2906
|
+
var renderContext = parentVnode && parentVnode.context;
|
2907
|
+
vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
|
2849
2908
|
vm.$scopedSlots = {};
|
2850
|
-
// bind the
|
2909
|
+
// bind the createElement fn to this instance
|
2851
2910
|
// so that we get proper render context inside it.
|
2852
|
-
|
2911
|
+
// args order: tag, data, children, needNormalization, alwaysNormalize
|
2912
|
+
// internal version is used by render functions compiled from templates
|
2913
|
+
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
2914
|
+
// normalization is always applied for the public version, used in
|
2915
|
+
// user-written render functions.
|
2916
|
+
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
2853
2917
|
if (vm.$options.el) {
|
2854
2918
|
vm.$mount(vm.$options.el);
|
2855
2919
|
}
|
@@ -2889,18 +2953,14 @@ function renderMixin (Vue) {
|
|
2889
2953
|
try {
|
2890
2954
|
vnode = render.call(vm._renderProxy, vm.$createElement);
|
2891
2955
|
} catch (e) {
|
2892
|
-
{
|
2893
|
-
warn(("Error when rendering " + (formatComponentName(vm)) + ":"));
|
2894
|
-
}
|
2895
2956
|
/* istanbul ignore else */
|
2896
2957
|
if (config.errorHandler) {
|
2897
2958
|
config.errorHandler.call(null, e, vm);
|
2898
2959
|
} else {
|
2899
|
-
|
2900
|
-
|
2901
|
-
} else {
|
2902
|
-
console.error(e);
|
2960
|
+
{
|
2961
|
+
warn(("Error when rendering " + (formatComponentName(vm)) + ":"));
|
2903
2962
|
}
|
2963
|
+
throw e
|
2904
2964
|
}
|
2905
2965
|
// return previous vnode to prevent render error causing blank component
|
2906
2966
|
vnode = vm._vnode;
|
@@ -2914,21 +2974,21 @@ function renderMixin (Vue) {
|
|
2914
2974
|
vm
|
2915
2975
|
);
|
2916
2976
|
}
|
2917
|
-
vnode =
|
2977
|
+
vnode = createEmptyVNode();
|
2918
2978
|
}
|
2919
2979
|
// set parent
|
2920
2980
|
vnode.parent = _parentVnode;
|
2921
2981
|
return vnode
|
2922
2982
|
};
|
2923
2983
|
|
2924
|
-
// shorthands used in render functions
|
2925
|
-
Vue.prototype._h = createElement;
|
2926
2984
|
// toString for mustaches
|
2927
2985
|
Vue.prototype._s = _toString;
|
2986
|
+
// convert text to vnode
|
2987
|
+
Vue.prototype._v = createTextVNode;
|
2928
2988
|
// number conversion
|
2929
2989
|
Vue.prototype._n = toNumber;
|
2930
2990
|
// empty vnode
|
2931
|
-
Vue.prototype._e =
|
2991
|
+
Vue.prototype._e = createEmptyVNode;
|
2932
2992
|
// loose equal
|
2933
2993
|
Vue.prototype._q = looseEqual;
|
2934
2994
|
// loose indexOf
|
@@ -2982,7 +3042,6 @@ function renderMixin (Vue) {
|
|
2982
3042
|
}
|
2983
3043
|
|
2984
3044
|
// filter resolution helper
|
2985
|
-
var identity = function (_) { return _; };
|
2986
3045
|
Vue.prototype._f = function resolveFilter (id) {
|
2987
3046
|
return resolveAsset(this.$options, 'filters', id, true) || identity
|
2988
3047
|
};
|
@@ -3070,21 +3129,29 @@ function renderMixin (Vue) {
|
|
3070
3129
|
return data
|
3071
3130
|
};
|
3072
3131
|
|
3073
|
-
//
|
3074
|
-
Vue.prototype._k = function
|
3075
|
-
|
3132
|
+
// check v-on keyCodes
|
3133
|
+
Vue.prototype._k = function checkKeyCodes (
|
3134
|
+
eventKeyCode,
|
3135
|
+
key,
|
3136
|
+
builtInAlias
|
3137
|
+
) {
|
3138
|
+
var keyCodes = config.keyCodes[key] || builtInAlias;
|
3139
|
+
if (Array.isArray(keyCodes)) {
|
3140
|
+
return keyCodes.indexOf(eventKeyCode) === -1
|
3141
|
+
} else {
|
3142
|
+
return keyCodes !== eventKeyCode
|
3143
|
+
}
|
3076
3144
|
};
|
3077
3145
|
}
|
3078
3146
|
|
3079
3147
|
function resolveSlots (
|
3080
|
-
|
3148
|
+
children,
|
3081
3149
|
context
|
3082
3150
|
) {
|
3083
3151
|
var slots = {};
|
3084
|
-
if (!
|
3152
|
+
if (!children) {
|
3085
3153
|
return slots
|
3086
3154
|
}
|
3087
|
-
var children = normalizeChildren(renderChildren) || [];
|
3088
3155
|
var defaultSlot = [];
|
3089
3156
|
var name, child;
|
3090
3157
|
for (var i = 0, l = children.length; i < l; i++) {
|
@@ -3119,10 +3186,12 @@ function initEvents (vm) {
|
|
3119
3186
|
vm._events = Object.create(null);
|
3120
3187
|
// init parent attached events
|
3121
3188
|
var listeners = vm.$options._parentListeners;
|
3122
|
-
var
|
3123
|
-
|
3189
|
+
var add = function (event, fn, once) {
|
3190
|
+
once ? vm.$once(event, fn) : vm.$on(event, fn);
|
3191
|
+
};
|
3192
|
+
var remove$$1 = bind$1(vm.$off, vm);
|
3124
3193
|
vm._updateListeners = function (listeners, oldListeners) {
|
3125
|
-
updateListeners(listeners, oldListeners || {},
|
3194
|
+
updateListeners(listeners, oldListeners || {}, add, remove$$1, vm);
|
3126
3195
|
};
|
3127
3196
|
if (listeners) {
|
3128
3197
|
vm._updateListeners(listeners);
|
@@ -3237,6 +3306,8 @@ function initInternalComponent (vm, options) {
|
|
3237
3306
|
opts._parentListeners = options._parentListeners;
|
3238
3307
|
opts._renderChildren = options._renderChildren;
|
3239
3308
|
opts._componentTag = options._componentTag;
|
3309
|
+
opts._parentElm = options._parentElm;
|
3310
|
+
opts._refElm = options._refElm;
|
3240
3311
|
if (options.render) {
|
3241
3312
|
opts.render = options.render;
|
3242
3313
|
opts.staticRenderFns = options.staticRenderFns;
|
@@ -3334,7 +3405,8 @@ function initExtend (Vue) {
|
|
3334
3405
|
if (!/^[a-zA-Z][\w-]*$/.test(name)) {
|
3335
3406
|
warn(
|
3336
3407
|
'Invalid component name: "' + name + '". Component names ' +
|
3337
|
-
'can only contain alphanumeric
|
3408
|
+
'can only contain alphanumeric characters and the hyphen, ' +
|
3409
|
+
'and must start with a letter.'
|
3338
3410
|
);
|
3339
3411
|
}
|
3340
3412
|
}
|
@@ -3488,7 +3560,7 @@ function initGlobalAPI (Vue) {
|
|
3488
3560
|
}
|
3489
3561
|
Object.defineProperty(Vue, 'config', configDef);
|
3490
3562
|
Vue.util = util;
|
3491
|
-
Vue.set = set;
|
3563
|
+
Vue.set = set$1;
|
3492
3564
|
Vue.delete = del;
|
3493
3565
|
Vue.nextTick = nextTick;
|
3494
3566
|
|
@@ -3515,14 +3587,15 @@ Object.defineProperty(Vue$3.prototype, '$isServer', {
|
|
3515
3587
|
get: isServerRendering
|
3516
3588
|
});
|
3517
3589
|
|
3518
|
-
Vue$3.version = '2.1.
|
3590
|
+
Vue$3.version = '2.1.6';
|
3519
3591
|
|
3520
3592
|
/* */
|
3521
3593
|
|
3522
3594
|
// attributes that should be using props for binding
|
3595
|
+
var acceptValue = makeMap('input,textarea,option,select');
|
3523
3596
|
var mustUseProp = function (tag, attr) {
|
3524
3597
|
return (
|
3525
|
-
(attr === 'value' && (tag
|
3598
|
+
(attr === 'value' && acceptValue(tag)) ||
|
3526
3599
|
(attr === 'selected' && tag === 'option') ||
|
3527
3600
|
(attr === 'checked' && tag === 'input') ||
|
3528
3601
|
(attr === 'muted' && tag === 'video')
|
@@ -3540,24 +3613,6 @@ var isBooleanAttr = makeMap(
|
|
3540
3613
|
'truespeed,typemustmatch,visible'
|
3541
3614
|
);
|
3542
3615
|
|
3543
|
-
var isAttr = makeMap(
|
3544
|
-
'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
|
3545
|
-
'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
|
3546
|
-
'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,' +
|
3547
|
-
'name,contenteditable,contextmenu,controls,coords,data,datetime,default,' +
|
3548
|
-
'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,' +
|
3549
|
-
'form,formaction,headers,<th>,height,hidden,high,href,hreflang,http-equiv,' +
|
3550
|
-
'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' +
|
3551
|
-
'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' +
|
3552
|
-
'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,' +
|
3553
|
-
'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' +
|
3554
|
-
'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' +
|
3555
|
-
'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' +
|
3556
|
-
'target,title,type,usemap,value,width,wrap'
|
3557
|
-
);
|
3558
|
-
|
3559
|
-
|
3560
|
-
|
3561
3616
|
var xlinkNS = 'http://www.w3.org/1999/xlink';
|
3562
3617
|
|
3563
3618
|
var isXlink = function (name) {
|
@@ -3666,34 +3721,10 @@ var isHTMLTag = makeMap(
|
|
3666
3721
|
'content,element,shadow,template'
|
3667
3722
|
);
|
3668
3723
|
|
3669
|
-
var isUnaryTag = makeMap(
|
3670
|
-
'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
3671
|
-
'link,meta,param,source,track,wbr',
|
3672
|
-
true
|
3673
|
-
);
|
3674
|
-
|
3675
|
-
// Elements that you can, intentionally, leave open
|
3676
|
-
// (and which close themselves)
|
3677
|
-
var canBeLeftOpenTag = makeMap(
|
3678
|
-
'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source',
|
3679
|
-
true
|
3680
|
-
);
|
3681
|
-
|
3682
|
-
// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
|
3683
|
-
// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
|
3684
|
-
var isNonPhrasingTag = makeMap(
|
3685
|
-
'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
|
3686
|
-
'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
3687
|
-
'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
3688
|
-
'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
3689
|
-
'title,tr,track',
|
3690
|
-
true
|
3691
|
-
);
|
3692
|
-
|
3693
3724
|
// this map is intentionally selective, only covering SVG elements that may
|
3694
3725
|
// contain child elements.
|
3695
3726
|
var isSVG = makeMap(
|
3696
|
-
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,
|
3727
|
+
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,' +
|
3697
3728
|
'font-face,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
3698
3729
|
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
3699
3730
|
true
|
@@ -3814,10 +3845,6 @@ function setTextContent (node, text) {
|
|
3814
3845
|
node.textContent = text;
|
3815
3846
|
}
|
3816
3847
|
|
3817
|
-
function childNodes (node) {
|
3818
|
-
return node.childNodes
|
3819
|
-
}
|
3820
|
-
|
3821
3848
|
function setAttribute (node, key, val) {
|
3822
3849
|
node.setAttribute(key, val);
|
3823
3850
|
}
|
@@ -3835,7 +3862,6 @@ var nodeOps = Object.freeze({
|
|
3835
3862
|
nextSibling: nextSibling,
|
3836
3863
|
tagName: tagName,
|
3837
3864
|
setTextContent: setTextContent,
|
3838
|
-
childNodes: childNodes,
|
3839
3865
|
setAttribute: setAttribute
|
3840
3866
|
});
|
3841
3867
|
|
@@ -3898,7 +3924,7 @@ function registerRef (vnode, isRemoval) {
|
|
3898
3924
|
|
3899
3925
|
var emptyNode = new VNode('', {}, []);
|
3900
3926
|
|
3901
|
-
var hooks$1 = ['create', 'update', 'remove', 'destroy'];
|
3927
|
+
var hooks$1 = ['create', 'activate', 'update', 'remove', 'destroy'];
|
3902
3928
|
|
3903
3929
|
function isUndef (s) {
|
3904
3930
|
return s == null
|
@@ -3963,26 +3989,23 @@ function createPatchFunction (backend) {
|
|
3963
3989
|
}
|
3964
3990
|
}
|
3965
3991
|
|
3966
|
-
|
3967
|
-
|
3968
|
-
|
3969
|
-
vnode
|
3970
|
-
|
3971
|
-
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode); }
|
3972
|
-
// after calling the init hook, if the vnode is a child component
|
3973
|
-
// it should've created a child instance and mounted it. the child
|
3974
|
-
// component also has set the placeholder vnode's elm.
|
3975
|
-
// in that case we can just return the element and be done.
|
3976
|
-
if (isDef(i = vnode.child)) {
|
3977
|
-
initComponent(vnode, insertedVnodeQueue);
|
3978
|
-
return vnode.elm
|
3979
|
-
}
|
3992
|
+
var inPre = 0;
|
3993
|
+
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
|
3994
|
+
vnode.isRootInsert = !nested; // for transition enter check
|
3995
|
+
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
|
3996
|
+
return
|
3980
3997
|
}
|
3998
|
+
|
3999
|
+
var data = vnode.data;
|
3981
4000
|
var children = vnode.children;
|
3982
4001
|
var tag = vnode.tag;
|
3983
4002
|
if (isDef(tag)) {
|
3984
4003
|
{
|
4004
|
+
if (data && data.pre) {
|
4005
|
+
inPre++;
|
4006
|
+
}
|
3985
4007
|
if (
|
4008
|
+
!inPre &&
|
3986
4009
|
!vnode.ns &&
|
3987
4010
|
!(config.ignoredElements && config.ignoredElements.indexOf(tag) > -1) &&
|
3988
4011
|
config.isUnknownElement(tag)
|
@@ -3999,22 +4022,85 @@ function createPatchFunction (backend) {
|
|
3999
4022
|
? nodeOps.createElementNS(vnode.ns, tag)
|
4000
4023
|
: nodeOps.createElement(tag, vnode);
|
4001
4024
|
setScope(vnode);
|
4002
|
-
|
4003
|
-
if
|
4004
|
-
|
4025
|
+
|
4026
|
+
/* istanbul ignore if */
|
4027
|
+
{
|
4028
|
+
createChildren(vnode, children, insertedVnodeQueue);
|
4029
|
+
if (isDef(data)) {
|
4030
|
+
invokeCreateHooks(vnode, insertedVnodeQueue);
|
4031
|
+
}
|
4032
|
+
insert(parentElm, vnode.elm, refElm);
|
4033
|
+
}
|
4034
|
+
|
4035
|
+
if ("development" !== 'production' && data && data.pre) {
|
4036
|
+
inPre--;
|
4005
4037
|
}
|
4006
4038
|
} else if (vnode.isComment) {
|
4007
4039
|
vnode.elm = nodeOps.createComment(vnode.text);
|
4040
|
+
insert(parentElm, vnode.elm, refElm);
|
4008
4041
|
} else {
|
4009
4042
|
vnode.elm = nodeOps.createTextNode(vnode.text);
|
4043
|
+
insert(parentElm, vnode.elm, refElm);
|
4044
|
+
}
|
4045
|
+
}
|
4046
|
+
|
4047
|
+
function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
4048
|
+
var i = vnode.data;
|
4049
|
+
if (isDef(i)) {
|
4050
|
+
var isReactivated = isDef(vnode.child) && i.keepAlive;
|
4051
|
+
if (isDef(i = i.hook) && isDef(i = i.init)) {
|
4052
|
+
i(vnode, false /* hydrating */, parentElm, refElm);
|
4053
|
+
}
|
4054
|
+
// after calling the init hook, if the vnode is a child component
|
4055
|
+
// it should've created a child instance and mounted it. the child
|
4056
|
+
// component also has set the placeholder vnode's elm.
|
4057
|
+
// in that case we can just return the element and be done.
|
4058
|
+
if (isDef(vnode.child)) {
|
4059
|
+
initComponent(vnode, insertedVnodeQueue);
|
4060
|
+
if (isReactivated) {
|
4061
|
+
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
4062
|
+
}
|
4063
|
+
return true
|
4064
|
+
}
|
4065
|
+
}
|
4066
|
+
}
|
4067
|
+
|
4068
|
+
function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
4069
|
+
var i;
|
4070
|
+
// hack for #4339: a reactivated component with inner transition
|
4071
|
+
// does not trigger because the inner node's created hooks are not called
|
4072
|
+
// again. It's not ideal to involve module-specific logic in here but
|
4073
|
+
// there doesn't seem to be a better way to do it.
|
4074
|
+
var innerNode = vnode;
|
4075
|
+
while (innerNode.child) {
|
4076
|
+
innerNode = innerNode.child._vnode;
|
4077
|
+
if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
|
4078
|
+
for (i = 0; i < cbs.activate.length; ++i) {
|
4079
|
+
cbs.activate[i](emptyNode, innerNode);
|
4080
|
+
}
|
4081
|
+
insertedVnodeQueue.push(innerNode);
|
4082
|
+
break
|
4083
|
+
}
|
4084
|
+
}
|
4085
|
+
// unlike a newly created component,
|
4086
|
+
// a reactivated keep-alive component doesn't insert itself
|
4087
|
+
insert(parentElm, vnode.elm, refElm);
|
4088
|
+
}
|
4089
|
+
|
4090
|
+
function insert (parent, elm, ref) {
|
4091
|
+
if (parent) {
|
4092
|
+
if (ref) {
|
4093
|
+
nodeOps.insertBefore(parent, elm, ref);
|
4094
|
+
} else {
|
4095
|
+
nodeOps.appendChild(parent, elm);
|
4096
|
+
}
|
4010
4097
|
}
|
4011
|
-
return vnode.elm
|
4012
4098
|
}
|
4013
4099
|
|
4014
4100
|
function createChildren (vnode, children, insertedVnodeQueue) {
|
4015
4101
|
if (Array.isArray(children)) {
|
4016
4102
|
for (var i = 0; i < children.length; ++i) {
|
4017
|
-
|
4103
|
+
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
|
4018
4104
|
}
|
4019
4105
|
} else if (isPrimitive(vnode.text)) {
|
4020
4106
|
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
|
@@ -4071,9 +4157,9 @@ function createPatchFunction (backend) {
|
|
4071
4157
|
}
|
4072
4158
|
}
|
4073
4159
|
|
4074
|
-
function addVnodes (parentElm,
|
4160
|
+
function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
|
4075
4161
|
for (; startIdx <= endIdx; ++startIdx) {
|
4076
|
-
|
4162
|
+
createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
|
4077
4163
|
}
|
4078
4164
|
}
|
4079
4165
|
|
@@ -4142,7 +4228,7 @@ function createPatchFunction (backend) {
|
|
4142
4228
|
var newEndIdx = newCh.length - 1;
|
4143
4229
|
var newStartVnode = newCh[0];
|
4144
4230
|
var newEndVnode = newCh[newEndIdx];
|
4145
|
-
var oldKeyToIdx, idxInOld, elmToMove,
|
4231
|
+
var oldKeyToIdx, idxInOld, elmToMove, refElm;
|
4146
4232
|
|
4147
4233
|
// removeOnly is a special flag used only by <transition-group>
|
4148
4234
|
// to ensure removed elements stay in correct relative positions
|
@@ -4176,7 +4262,7 @@ function createPatchFunction (backend) {
|
|
4176
4262
|
if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
|
4177
4263
|
idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
|
4178
4264
|
if (isUndef(idxInOld)) { // New element
|
4179
|
-
|
4265
|
+
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
|
4180
4266
|
newStartVnode = newCh[++newStartIdx];
|
4181
4267
|
} else {
|
4182
4268
|
elmToMove = oldCh[idxInOld];
|
@@ -4187,22 +4273,22 @@ function createPatchFunction (backend) {
|
|
4187
4273
|
'Make sure each v-for item has a unique key.'
|
4188
4274
|
);
|
4189
4275
|
}
|
4190
|
-
if (elmToMove
|
4191
|
-
// same key but different element. treat as new element
|
4192
|
-
nodeOps.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
|
4193
|
-
newStartVnode = newCh[++newStartIdx];
|
4194
|
-
} else {
|
4276
|
+
if (sameVnode(elmToMove, newStartVnode)) {
|
4195
4277
|
patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
|
4196
4278
|
oldCh[idxInOld] = undefined;
|
4197
4279
|
canMove && nodeOps.insertBefore(parentElm, newStartVnode.elm, oldStartVnode.elm);
|
4198
4280
|
newStartVnode = newCh[++newStartIdx];
|
4281
|
+
} else {
|
4282
|
+
// same key but different element. treat as new element
|
4283
|
+
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
|
4284
|
+
newStartVnode = newCh[++newStartIdx];
|
4199
4285
|
}
|
4200
4286
|
}
|
4201
4287
|
}
|
4202
4288
|
}
|
4203
4289
|
if (oldStartIdx > oldEndIdx) {
|
4204
|
-
|
4205
|
-
addVnodes(parentElm,
|
4290
|
+
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
4291
|
+
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
4206
4292
|
} else if (newStartIdx > newEndIdx) {
|
4207
4293
|
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
4208
4294
|
}
|
@@ -4269,6 +4355,11 @@ function createPatchFunction (backend) {
|
|
4269
4355
|
}
|
4270
4356
|
|
4271
4357
|
var bailed = false;
|
4358
|
+
// list of modules that can skip create hook during hydration because they
|
4359
|
+
// are already rendered on the client or has no need for initialization
|
4360
|
+
var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
|
4361
|
+
|
4362
|
+
// Note: this is a browser-only function so we can assume elms are DOM nodes.
|
4272
4363
|
function hydrate (elm, vnode, insertedVnodeQueue) {
|
4273
4364
|
{
|
4274
4365
|
if (!assertNodeMatch(elm, vnode)) {
|
@@ -4289,36 +4380,40 @@ function createPatchFunction (backend) {
|
|
4289
4380
|
}
|
4290
4381
|
if (isDef(tag)) {
|
4291
4382
|
if (isDef(children)) {
|
4292
|
-
var childNodes = nodeOps.childNodes(elm);
|
4293
4383
|
// empty element, allow client to pick up and populate children
|
4294
|
-
if (!
|
4384
|
+
if (!elm.hasChildNodes()) {
|
4295
4385
|
createChildren(vnode, children, insertedVnodeQueue);
|
4296
4386
|
} else {
|
4297
4387
|
var childrenMatch = true;
|
4298
|
-
|
4299
|
-
|
4300
|
-
|
4301
|
-
|
4302
|
-
|
4303
|
-
childrenMatch = false;
|
4304
|
-
break
|
4305
|
-
}
|
4388
|
+
var childNode = elm.firstChild;
|
4389
|
+
for (var i$1 = 0; i$1 < children.length; i$1++) {
|
4390
|
+
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
|
4391
|
+
childrenMatch = false;
|
4392
|
+
break
|
4306
4393
|
}
|
4394
|
+
childNode = childNode.nextSibling;
|
4307
4395
|
}
|
4308
|
-
if
|
4396
|
+
// if childNode is not null, it means the actual childNodes list is
|
4397
|
+
// longer than the virtual children list.
|
4398
|
+
if (!childrenMatch || childNode) {
|
4309
4399
|
if ("development" !== 'production' &&
|
4310
4400
|
typeof console !== 'undefined' &&
|
4311
4401
|
!bailed) {
|
4312
4402
|
bailed = true;
|
4313
4403
|
console.warn('Parent: ', elm);
|
4314
|
-
console.warn('Mismatching childNodes vs. VNodes: ', childNodes, children);
|
4404
|
+
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
|
4315
4405
|
}
|
4316
4406
|
return false
|
4317
4407
|
}
|
4318
4408
|
}
|
4319
4409
|
}
|
4320
4410
|
if (isDef(data)) {
|
4321
|
-
|
4411
|
+
for (var key in data) {
|
4412
|
+
if (!isRenderedModule(key)) {
|
4413
|
+
invokeCreateHooks(vnode, insertedVnodeQueue);
|
4414
|
+
break
|
4415
|
+
}
|
4416
|
+
}
|
4322
4417
|
}
|
4323
4418
|
}
|
4324
4419
|
return true
|
@@ -4328,14 +4423,14 @@ function createPatchFunction (backend) {
|
|
4328
4423
|
if (vnode.tag) {
|
4329
4424
|
return (
|
4330
4425
|
vnode.tag.indexOf('vue-component') === 0 ||
|
4331
|
-
vnode.tag.toLowerCase() ===
|
4426
|
+
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
|
4332
4427
|
)
|
4333
4428
|
} else {
|
4334
4429
|
return _toString(vnode.text) === node.data
|
4335
4430
|
}
|
4336
4431
|
}
|
4337
4432
|
|
4338
|
-
return function patch (oldVnode, vnode, hydrating, removeOnly) {
|
4433
|
+
return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
|
4339
4434
|
if (!vnode) {
|
4340
4435
|
if (oldVnode) { invokeDestroyHook(oldVnode); }
|
4341
4436
|
return
|
@@ -4346,12 +4441,13 @@ function createPatchFunction (backend) {
|
|
4346
4441
|
var insertedVnodeQueue = [];
|
4347
4442
|
|
4348
4443
|
if (!oldVnode) {
|
4349
|
-
// empty mount, create new root element
|
4444
|
+
// empty mount (likely as component), create new root element
|
4350
4445
|
isInitialPatch = true;
|
4351
|
-
createElm(vnode, insertedVnodeQueue);
|
4446
|
+
createElm(vnode, insertedVnodeQueue, parentElm, refElm);
|
4352
4447
|
} else {
|
4353
4448
|
var isRealElement = isDef(oldVnode.nodeType);
|
4354
4449
|
if (!isRealElement && sameVnode(oldVnode, vnode)) {
|
4450
|
+
// patch existing root node
|
4355
4451
|
patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
|
4356
4452
|
} else {
|
4357
4453
|
if (isRealElement) {
|
@@ -4380,14 +4476,15 @@ function createPatchFunction (backend) {
|
|
4380
4476
|
// create an empty node and replace it
|
4381
4477
|
oldVnode = emptyNodeAt(oldVnode);
|
4382
4478
|
}
|
4479
|
+
|
4480
|
+
// replacing existing element
|
4383
4481
|
elm = oldVnode.elm;
|
4384
4482
|
parent = nodeOps.parentNode(elm);
|
4483
|
+
createElm(vnode, insertedVnodeQueue, parent, nodeOps.nextSibling(elm));
|
4385
4484
|
|
4386
|
-
createElm(vnode, insertedVnodeQueue);
|
4387
|
-
|
4388
|
-
// component root element replaced.
|
4389
|
-
// update parent placeholder node element, recursively
|
4390
4485
|
if (vnode.parent) {
|
4486
|
+
// component root element replaced.
|
4487
|
+
// update parent placeholder node element, recursively
|
4391
4488
|
var ancestor = vnode.parent;
|
4392
4489
|
while (ancestor) {
|
4393
4490
|
ancestor.elm = vnode.elm;
|
@@ -4401,7 +4498,6 @@ function createPatchFunction (backend) {
|
|
4401
4498
|
}
|
4402
4499
|
|
4403
4500
|
if (parent !== null) {
|
4404
|
-
nodeOps.insertBefore(parent, vnode.elm, nodeOps.nextSibling(elm));
|
4405
4501
|
removeVnodes(parent, [oldVnode], 0, 0);
|
4406
4502
|
} else if (isDef(oldVnode.tag)) {
|
4407
4503
|
invokeDestroyHook(oldVnode);
|
@@ -4424,13 +4520,13 @@ var directives = {
|
|
4424
4520
|
}
|
4425
4521
|
};
|
4426
4522
|
|
4427
|
-
function updateDirectives (
|
4428
|
-
oldVnode
|
4429
|
-
|
4430
|
-
) {
|
4431
|
-
if (!oldVnode.data.directives && !vnode.data.directives) {
|
4432
|
-
return
|
4523
|
+
function updateDirectives (oldVnode, vnode) {
|
4524
|
+
if (oldVnode.data.directives || vnode.data.directives) {
|
4525
|
+
_update(oldVnode, vnode);
|
4433
4526
|
}
|
4527
|
+
}
|
4528
|
+
|
4529
|
+
function _update (oldVnode, vnode) {
|
4434
4530
|
var isCreate = oldVnode === emptyNode;
|
4435
4531
|
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
|
4436
4532
|
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
|
@@ -4460,9 +4556,9 @@ function updateDirectives (
|
|
4460
4556
|
|
4461
4557
|
if (dirsWithInsert.length) {
|
4462
4558
|
var callInsert = function () {
|
4463
|
-
dirsWithInsert.
|
4464
|
-
callHook$1(
|
4465
|
-
}
|
4559
|
+
for (var i = 0; i < dirsWithInsert.length; i++) {
|
4560
|
+
callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
|
4561
|
+
}
|
4466
4562
|
};
|
4467
4563
|
if (isCreate) {
|
4468
4564
|
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert, 'dir-insert');
|
@@ -4473,9 +4569,9 @@ function updateDirectives (
|
|
4473
4569
|
|
4474
4570
|
if (dirsWithPostpatch.length) {
|
4475
4571
|
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
|
4476
|
-
dirsWithPostpatch.
|
4477
|
-
callHook$1(
|
4478
|
-
}
|
4572
|
+
for (var i = 0; i < dirsWithPostpatch.length; i++) {
|
4573
|
+
callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
|
4574
|
+
}
|
4479
4575
|
}, 'dir-postpatch');
|
4480
4576
|
}
|
4481
4577
|
|
@@ -4549,6 +4645,11 @@ function updateAttrs (oldVnode, vnode) {
|
|
4549
4645
|
setAttr(elm, key, cur);
|
4550
4646
|
}
|
4551
4647
|
}
|
4648
|
+
// #4391: in IE9, setting type can reset value for input[type=radio]
|
4649
|
+
/* istanbul ignore if */
|
4650
|
+
if (isIE9 && attrs.value !== oldAttrs.value) {
|
4651
|
+
setAttr(elm, 'value', attrs.value);
|
4652
|
+
}
|
4552
4653
|
for (key in oldAttrs) {
|
4553
4654
|
if (attrs[key] == null) {
|
4554
4655
|
if (isXlink(key)) {
|
@@ -4622,8 +4723,26 @@ var klass = {
|
|
4622
4723
|
update: updateClass
|
4623
4724
|
};
|
4624
4725
|
|
4625
|
-
|
4626
|
-
|
4726
|
+
/* */
|
4727
|
+
|
4728
|
+
var target;
|
4729
|
+
|
4730
|
+
function add$1 (event, handler, once, capture) {
|
4731
|
+
if (once) {
|
4732
|
+
var oldHandler = handler;
|
4733
|
+
handler = function (ev) {
|
4734
|
+
remove$2(event, handler, capture);
|
4735
|
+
arguments.length === 1
|
4736
|
+
? oldHandler(ev)
|
4737
|
+
: oldHandler.apply(null, arguments);
|
4738
|
+
};
|
4739
|
+
}
|
4740
|
+
target.addEventListener(event, handler, capture);
|
4741
|
+
}
|
4742
|
+
|
4743
|
+
function remove$2 (event, handler, capture) {
|
4744
|
+
target.removeEventListener(event, handler, capture);
|
4745
|
+
}
|
4627
4746
|
|
4628
4747
|
function updateDOMListeners (oldVnode, vnode) {
|
4629
4748
|
if (!oldVnode.data.on && !vnode.data.on) {
|
@@ -4631,13 +4750,8 @@ function updateDOMListeners (oldVnode, vnode) {
|
|
4631
4750
|
}
|
4632
4751
|
var on = vnode.data.on || {};
|
4633
4752
|
var oldOn = oldVnode.data.on || {};
|
4634
|
-
|
4635
|
-
|
4636
|
-
});
|
4637
|
-
var remove = vnode.elm._v_remove || (vnode.elm._v_remove = function (event, handler) {
|
4638
|
-
vnode.elm.removeEventListener(event, handler);
|
4639
|
-
});
|
4640
|
-
updateListeners(on, oldOn, add, remove, vnode.context);
|
4753
|
+
target = vnode.elm;
|
4754
|
+
updateListeners(on, oldOn, add$1, remove$2, vnode.context);
|
4641
4755
|
}
|
4642
4756
|
|
4643
4757
|
var events = {
|
@@ -4680,7 +4794,10 @@ function updateDOMProps (oldVnode, vnode) {
|
|
4680
4794
|
elm._value = cur;
|
4681
4795
|
// avoid resetting cursor position when value is the same
|
4682
4796
|
var strCur = cur == null ? '' : String(cur);
|
4683
|
-
if (elm.
|
4797
|
+
if (!elm.composing && (
|
4798
|
+
(document.activeElement !== elm && elm.value !== strCur) ||
|
4799
|
+
isValueChanged(vnode, strCur)
|
4800
|
+
)) {
|
4684
4801
|
elm.value = strCur;
|
4685
4802
|
}
|
4686
4803
|
} else {
|
@@ -4689,6 +4806,18 @@ function updateDOMProps (oldVnode, vnode) {
|
|
4689
4806
|
}
|
4690
4807
|
}
|
4691
4808
|
|
4809
|
+
function isValueChanged (vnode, newVal) {
|
4810
|
+
var value = vnode.elm.value;
|
4811
|
+
var modifiers = vnode.elm._vModifiers; // injected by v-model runtime
|
4812
|
+
if ((modifiers && modifiers.number) || vnode.elm.type === 'number') {
|
4813
|
+
return toNumber(value) !== toNumber(newVal)
|
4814
|
+
}
|
4815
|
+
if (modifiers && modifiers.trim) {
|
4816
|
+
return value.trim() !== newVal.trim()
|
4817
|
+
}
|
4818
|
+
return value !== newVal
|
4819
|
+
}
|
4820
|
+
|
4692
4821
|
var domProps = {
|
4693
4822
|
create: updateDOMProps,
|
4694
4823
|
update: updateDOMProps
|
@@ -4698,10 +4827,8 @@ var domProps = {
|
|
4698
4827
|
|
4699
4828
|
var parseStyleText = cached(function (cssText) {
|
4700
4829
|
var res = {};
|
4701
|
-
var
|
4702
|
-
|
4703
|
-
var listDelimiter = hasBackground ? /;(?![^(]*\))/g : ';';
|
4704
|
-
var propertyDelimiter = hasBackground ? /:(.+)/ : ':';
|
4830
|
+
var listDelimiter = /;(?![^(]*\))/g;
|
4831
|
+
var propertyDelimiter = /:(.+)/;
|
4705
4832
|
cssText.split(listDelimiter).forEach(function (item) {
|
4706
4833
|
if (item) {
|
4707
4834
|
var tmp = item.split(propertyDelimiter);
|
@@ -4766,10 +4893,13 @@ function getStyle (vnode, checkChild) {
|
|
4766
4893
|
/* */
|
4767
4894
|
|
4768
4895
|
var cssVarRE = /^--/;
|
4896
|
+
var importantRE = /\s*!important$/;
|
4769
4897
|
var setProp = function (el, name, val) {
|
4770
4898
|
/* istanbul ignore if */
|
4771
4899
|
if (cssVarRE.test(name)) {
|
4772
4900
|
el.style.setProperty(name, val);
|
4901
|
+
} else if (importantRE.test(val)) {
|
4902
|
+
el.style.setProperty(name, val.replace(importantRE, ''), 'important');
|
4773
4903
|
} else {
|
4774
4904
|
el.style[normalize(name)] = val;
|
4775
4905
|
}
|
@@ -5032,7 +5162,7 @@ function toMs (s) {
|
|
5032
5162
|
|
5033
5163
|
/* */
|
5034
5164
|
|
5035
|
-
function enter (vnode) {
|
5165
|
+
function enter (vnode, toggleDisplay) {
|
5036
5166
|
var el = vnode.elm;
|
5037
5167
|
|
5038
5168
|
// call leave callback now
|
@@ -5070,10 +5200,12 @@ function enter (vnode) {
|
|
5070
5200
|
// transition. One edge case to check is when the <transition> is placed
|
5071
5201
|
// as the root node of a child component. In that case we need to check
|
5072
5202
|
// <transition>'s parent for appear check.
|
5203
|
+
var context = activeInstance;
|
5073
5204
|
var transitionNode = activeInstance.$vnode;
|
5074
|
-
|
5075
|
-
|
5076
|
-
|
5205
|
+
while (transitionNode && transitionNode.parent) {
|
5206
|
+
transitionNode = transitionNode.parent;
|
5207
|
+
context = transitionNode.context;
|
5208
|
+
}
|
5077
5209
|
|
5078
5210
|
var isAppear = !context._isMounted || !vnode.isRootInsert;
|
5079
5211
|
|
@@ -5115,7 +5247,10 @@ function enter (vnode) {
|
|
5115
5247
|
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
|
5116
5248
|
var parent = el.parentNode;
|
5117
5249
|
var pendingNode = parent && parent._pending && parent._pending[vnode.key];
|
5118
|
-
if (pendingNode &&
|
5250
|
+
if (pendingNode &&
|
5251
|
+
pendingNode.context === vnode.context &&
|
5252
|
+
pendingNode.tag === vnode.tag &&
|
5253
|
+
pendingNode.elm._leaveCb) {
|
5119
5254
|
pendingNode.elm._leaveCb();
|
5120
5255
|
}
|
5121
5256
|
enterHook && enterHook(el, cb);
|
@@ -5136,6 +5271,7 @@ function enter (vnode) {
|
|
5136
5271
|
}
|
5137
5272
|
|
5138
5273
|
if (vnode.data.show) {
|
5274
|
+
toggleDisplay && toggleDisplay();
|
5139
5275
|
enterHook && enterHook(el, cb);
|
5140
5276
|
}
|
5141
5277
|
|
@@ -5270,12 +5406,15 @@ function once (fn) {
|
|
5270
5406
|
}
|
5271
5407
|
}
|
5272
5408
|
|
5409
|
+
function _enter (_, vnode) {
|
5410
|
+
if (!vnode.data.show) {
|
5411
|
+
enter(vnode);
|
5412
|
+
}
|
5413
|
+
}
|
5414
|
+
|
5273
5415
|
var transition = inBrowser ? {
|
5274
|
-
create:
|
5275
|
-
|
5276
|
-
enter(vnode);
|
5277
|
-
}
|
5278
|
-
},
|
5416
|
+
create: _enter,
|
5417
|
+
activate: _enter,
|
5279
5418
|
remove: function remove (vnode, rm) {
|
5280
5419
|
/* istanbul ignore else */
|
5281
5420
|
if (!vnode.data.show) {
|
@@ -5342,17 +5481,17 @@ var model = {
|
|
5342
5481
|
if (isIE || isEdge) {
|
5343
5482
|
setTimeout(cb, 0);
|
5344
5483
|
}
|
5345
|
-
} else if (
|
5346
|
-
|
5347
|
-
!binding.modifiers.lazy
|
5348
|
-
|
5349
|
-
|
5350
|
-
|
5351
|
-
|
5352
|
-
|
5353
|
-
|
5354
|
-
|
5355
|
-
|
5484
|
+
} else if (vnode.tag === 'textarea' || el.type === 'text') {
|
5485
|
+
el._vModifiers = binding.modifiers;
|
5486
|
+
if (!binding.modifiers.lazy) {
|
5487
|
+
if (!isAndroid) {
|
5488
|
+
el.addEventListener('compositionstart', onCompositionStart);
|
5489
|
+
el.addEventListener('compositionend', onCompositionEnd);
|
5490
|
+
}
|
5491
|
+
/* istanbul ignore if */
|
5492
|
+
if (isIE9) {
|
5493
|
+
el.vmodel = true;
|
5494
|
+
}
|
5356
5495
|
}
|
5357
5496
|
}
|
5358
5497
|
},
|
@@ -5451,12 +5590,16 @@ var show = {
|
|
5451
5590
|
|
5452
5591
|
vnode = locateNode(vnode);
|
5453
5592
|
var transition = vnode.data && vnode.data.transition;
|
5593
|
+
var originalDisplay = el.__vOriginalDisplay =
|
5594
|
+
el.style.display === 'none' ? '' : el.style.display;
|
5454
5595
|
if (value && transition && !isIE9) {
|
5455
|
-
|
5596
|
+
vnode.data.show = true;
|
5597
|
+
enter(vnode, function () {
|
5598
|
+
el.style.display = originalDisplay;
|
5599
|
+
});
|
5600
|
+
} else {
|
5601
|
+
el.style.display = value ? originalDisplay : 'none';
|
5456
5602
|
}
|
5457
|
-
var originalDisplay = el.style.display === 'none' ? '' : el.style.display;
|
5458
|
-
el.style.display = value ? originalDisplay : 'none';
|
5459
|
-
el.__vOriginalDisplay = originalDisplay;
|
5460
5603
|
},
|
5461
5604
|
update: function update (el, ref, vnode) {
|
5462
5605
|
var value = ref.value;
|
@@ -5467,9 +5610,11 @@ var show = {
|
|
5467
5610
|
vnode = locateNode(vnode);
|
5468
5611
|
var transition = vnode.data && vnode.data.transition;
|
5469
5612
|
if (transition && !isIE9) {
|
5613
|
+
vnode.data.show = true;
|
5470
5614
|
if (value) {
|
5471
|
-
enter(vnode)
|
5472
|
-
|
5615
|
+
enter(vnode, function () {
|
5616
|
+
el.style.display = el.__vOriginalDisplay;
|
5617
|
+
});
|
5473
5618
|
} else {
|
5474
5619
|
leave(vnode, function () {
|
5475
5620
|
el.style.display = 'none';
|
@@ -5841,7 +5986,7 @@ setTimeout(function () {
|
|
5841
5986
|
devtools.emit('init', Vue$3);
|
5842
5987
|
} else if (
|
5843
5988
|
"development" !== 'production' &&
|
5844
|
-
inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)
|
5989
|
+
inBrowser && !isEdge && /Chrome\/\d+/.test(window.navigator.userAgent)
|
5845
5990
|
) {
|
5846
5991
|
console.log(
|
5847
5992
|
'Download the Vue Devtools for a better development experience:\n' +
|
@@ -5874,6 +6019,32 @@ function decode (html) {
|
|
5874
6019
|
return decoder.textContent
|
5875
6020
|
}
|
5876
6021
|
|
6022
|
+
/* */
|
6023
|
+
|
6024
|
+
var isUnaryTag = makeMap(
|
6025
|
+
'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
6026
|
+
'link,meta,param,source,track,wbr',
|
6027
|
+
true
|
6028
|
+
);
|
6029
|
+
|
6030
|
+
// Elements that you can, intentionally, leave open
|
6031
|
+
// (and which close themselves)
|
6032
|
+
var canBeLeftOpenTag = makeMap(
|
6033
|
+
'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source',
|
6034
|
+
true
|
6035
|
+
);
|
6036
|
+
|
6037
|
+
// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
|
6038
|
+
// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
|
6039
|
+
var isNonPhrasingTag = makeMap(
|
6040
|
+
'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
|
6041
|
+
'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
6042
|
+
'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
6043
|
+
'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
6044
|
+
'title,tr,track',
|
6045
|
+
true
|
6046
|
+
);
|
6047
|
+
|
5877
6048
|
/**
|
5878
6049
|
* Not type-checking this file because it's mostly vendor code.
|
5879
6050
|
*/
|
@@ -6228,7 +6399,6 @@ function parseFilters (exp) {
|
|
6228
6399
|
case 0x22: inDouble = true; break // "
|
6229
6400
|
case 0x27: inSingle = true; break // '
|
6230
6401
|
case 0x60: inTemplateString = true; break // `
|
6231
|
-
case 0x2f: inRegex = true; break // /
|
6232
6402
|
case 0x28: paren++; break // (
|
6233
6403
|
case 0x29: paren--; break // )
|
6234
6404
|
case 0x5B: square++; break // [
|
@@ -6236,6 +6406,18 @@ function parseFilters (exp) {
|
|
6236
6406
|
case 0x7B: curly++; break // {
|
6237
6407
|
case 0x7D: curly--; break // }
|
6238
6408
|
}
|
6409
|
+
if (c === 0x2f) { // /
|
6410
|
+
var j = i - 1;
|
6411
|
+
var p = (void 0);
|
6412
|
+
// find first non-whitespace prev char
|
6413
|
+
for (; j >= 0; j--) {
|
6414
|
+
p = exp.charAt(j);
|
6415
|
+
if (p !== ' ') { break }
|
6416
|
+
}
|
6417
|
+
if (!p || !/[\w$]/.test(p)) {
|
6418
|
+
inRegex = true;
|
6419
|
+
}
|
6420
|
+
}
|
6239
6421
|
}
|
6240
6422
|
}
|
6241
6423
|
|
@@ -6356,6 +6538,10 @@ function addHandler (
|
|
6356
6538
|
delete modifiers.capture;
|
6357
6539
|
name = '!' + name; // mark the event as captured
|
6358
6540
|
}
|
6541
|
+
if (modifiers && modifiers.once) {
|
6542
|
+
delete modifiers.once;
|
6543
|
+
name = '~' + name; // mark the event as once
|
6544
|
+
}
|
6359
6545
|
var events;
|
6360
6546
|
if (modifiers && modifiers.native) {
|
6361
6547
|
delete modifiers.native;
|
@@ -6833,10 +7019,10 @@ function processIfConditions (el, parent) {
|
|
6833
7019
|
}
|
6834
7020
|
|
6835
7021
|
function addIfCondition (el, condition) {
|
6836
|
-
if (!el.
|
6837
|
-
el.
|
7022
|
+
if (!el.ifConditions) {
|
7023
|
+
el.ifConditions = [];
|
6838
7024
|
}
|
6839
|
-
el.
|
7025
|
+
el.ifConditions.push(condition);
|
6840
7026
|
}
|
6841
7027
|
|
6842
7028
|
function processOnce (el) {
|
@@ -6894,6 +7080,7 @@ function processAttrs (el) {
|
|
6894
7080
|
if (bindRE.test(name)) { // v-bind
|
6895
7081
|
name = name.replace(bindRE, '');
|
6896
7082
|
value = parseFilters(value);
|
7083
|
+
isProp = false;
|
6897
7084
|
if (modifiers) {
|
6898
7085
|
if (modifiers.prop) {
|
6899
7086
|
isProp = true;
|
@@ -7043,7 +7230,7 @@ var genStaticKeysCached = cached(genStaticKeys$1);
|
|
7043
7230
|
function optimize (root, options) {
|
7044
7231
|
if (!root) { return }
|
7045
7232
|
isStaticKey = genStaticKeysCached(options.staticKeys || '');
|
7046
|
-
isPlatformReservedTag = options.isReservedTag ||
|
7233
|
+
isPlatformReservedTag = options.isReservedTag || no;
|
7047
7234
|
// first pass: mark all non-static nodes.
|
7048
7235
|
markStatic(root);
|
7049
7236
|
// second pass: mark static roots.
|
@@ -7102,8 +7289,8 @@ function markStaticRoots (node, isInFor) {
|
|
7102
7289
|
markStaticRoots(node.children[i], isInFor || !!node.for);
|
7103
7290
|
}
|
7104
7291
|
}
|
7105
|
-
if (node.
|
7106
|
-
walkThroughConditionsBlocks(node.
|
7292
|
+
if (node.ifConditions) {
|
7293
|
+
walkThroughConditionsBlocks(node.ifConditions, isInFor);
|
7107
7294
|
}
|
7108
7295
|
}
|
7109
7296
|
}
|
@@ -7165,11 +7352,7 @@ var keyCodes = {
|
|
7165
7352
|
var modifierCode = {
|
7166
7353
|
stop: '$event.stopPropagation();',
|
7167
7354
|
prevent: '$event.preventDefault();',
|
7168
|
-
self: 'if($event.target !== $event.currentTarget)return;'
|
7169
|
-
};
|
7170
|
-
|
7171
|
-
var isMouseEventRE = /^mouse|^pointer|^(click|dblclick|contextmenu|wheel)$/;
|
7172
|
-
var mouseEventModifierCode = {
|
7355
|
+
self: 'if($event.target !== $event.currentTarget)return;',
|
7173
7356
|
ctrl: 'if(!$event.ctrlKey)return;',
|
7174
7357
|
shift: 'if(!$event.shiftKey)return;',
|
7175
7358
|
alt: 'if(!$event.altKey)return;',
|
@@ -7199,12 +7382,9 @@ function genHandler (
|
|
7199
7382
|
} else {
|
7200
7383
|
var code = '';
|
7201
7384
|
var keys = [];
|
7202
|
-
var isMouseEvnet = isMouseEventRE.test(name);
|
7203
7385
|
for (var key in handler.modifiers) {
|
7204
7386
|
if (modifierCode[key]) {
|
7205
7387
|
code += modifierCode[key];
|
7206
|
-
} else if (isMouseEvnet && mouseEventModifierCode[key]) {
|
7207
|
-
code += mouseEventModifierCode[key];
|
7208
7388
|
} else {
|
7209
7389
|
keys.push(key);
|
7210
7390
|
}
|
@@ -7220,22 +7400,16 @@ function genHandler (
|
|
7220
7400
|
}
|
7221
7401
|
|
7222
7402
|
function genKeyFilter (keys) {
|
7223
|
-
|
7224
|
-
? normalizeKeyCode(keys[0])
|
7225
|
-
: Array.prototype.concat.apply([], keys.map(normalizeKeyCode));
|
7226
|
-
if (Array.isArray(code)) {
|
7227
|
-
return ("if(" + (code.map(function (c) { return ("$event.keyCode!==" + c); }).join('&&')) + ")return;")
|
7228
|
-
} else {
|
7229
|
-
return ("if($event.keyCode!==" + code + ")return;")
|
7230
|
-
}
|
7403
|
+
return ("if(" + (keys.map(genFilterCode).join('&&')) + ")return;")
|
7231
7404
|
}
|
7232
7405
|
|
7233
|
-
function
|
7234
|
-
|
7235
|
-
|
7236
|
-
|
7237
|
-
|
7238
|
-
|
7406
|
+
function genFilterCode (key) {
|
7407
|
+
var keyVal = parseInt(key, 10);
|
7408
|
+
if (keyVal) {
|
7409
|
+
return ("$event.keyCode!==" + keyVal)
|
7410
|
+
}
|
7411
|
+
var alias = keyCodes[key];
|
7412
|
+
return ("_k($event.keyCode," + (JSON.stringify(key)) + (alias ? ',' + JSON.stringify(alias) : '') + ")")
|
7239
7413
|
}
|
7240
7414
|
|
7241
7415
|
/* */
|
@@ -7276,7 +7450,7 @@ function generate (
|
|
7276
7450
|
transforms$1 = pluckModuleFunction(options.modules, 'transformCode');
|
7277
7451
|
dataGenFns = pluckModuleFunction(options.modules, 'genData');
|
7278
7452
|
platformDirectives$1 = options.directives || {};
|
7279
|
-
var code = ast ? genElement(ast) : '
|
7453
|
+
var code = ast ? genElement(ast) : '_c("div")';
|
7280
7454
|
staticRenderFns = prevStaticRenderFns;
|
7281
7455
|
onceCount = prevOnceCount;
|
7282
7456
|
return {
|
@@ -7306,8 +7480,8 @@ function genElement (el) {
|
|
7306
7480
|
} else {
|
7307
7481
|
var data = el.plain ? undefined : genData(el);
|
7308
7482
|
|
7309
|
-
var children = el.inlineTemplate ? null : genChildren(el);
|
7310
|
-
code = "
|
7483
|
+
var children = el.inlineTemplate ? null : genChildren(el, true);
|
7484
|
+
code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
|
7311
7485
|
}
|
7312
7486
|
// module transforms
|
7313
7487
|
for (var i = 0; i < transforms$1.length; i++) {
|
@@ -7353,7 +7527,7 @@ function genOnce (el) {
|
|
7353
7527
|
|
7354
7528
|
function genIf (el) {
|
7355
7529
|
el.ifProcessed = true; // avoid recursion
|
7356
|
-
return genIfConditions(el.
|
7530
|
+
return genIfConditions(el.ifConditions.slice())
|
7357
7531
|
}
|
7358
7532
|
|
7359
7533
|
function genIfConditions (conditions) {
|
@@ -7368,7 +7542,7 @@ function genIfConditions (conditions) {
|
|
7368
7542
|
return ("" + (genTernaryExp(condition.block)))
|
7369
7543
|
}
|
7370
7544
|
|
7371
|
-
// v-if with v-once
|
7545
|
+
// v-if with v-once should generate code like (a)?_m(0):_m(1)
|
7372
7546
|
function genTernaryExp (el) {
|
7373
7547
|
return el.once ? genOnce(el) : genElement(el)
|
7374
7548
|
}
|
@@ -7405,6 +7579,10 @@ function genData (el) {
|
|
7405
7579
|
if (el.refInFor) {
|
7406
7580
|
data += "refInFor:true,";
|
7407
7581
|
}
|
7582
|
+
// pre
|
7583
|
+
if (el.pre) {
|
7584
|
+
data += "pre:true,";
|
7585
|
+
}
|
7408
7586
|
// record original tag name for components using "is" attribute
|
7409
7587
|
if (el.component) {
|
7410
7588
|
data += "tag:\"" + (el.tag) + "\",";
|
@@ -7500,10 +7678,36 @@ function genScopedSlot (key, el) {
|
|
7500
7678
|
: genElement(el)) + "}"
|
7501
7679
|
}
|
7502
7680
|
|
7503
|
-
function genChildren (el) {
|
7504
|
-
|
7505
|
-
|
7681
|
+
function genChildren (el, checkSkip) {
|
7682
|
+
var children = el.children;
|
7683
|
+
if (children.length) {
|
7684
|
+
var el$1 = children[0];
|
7685
|
+
// optimize single v-for
|
7686
|
+
if (children.length === 1 &&
|
7687
|
+
el$1.for &&
|
7688
|
+
el$1.tag !== 'template' &&
|
7689
|
+
el$1.tag !== 'slot') {
|
7690
|
+
return genElement(el$1)
|
7691
|
+
}
|
7692
|
+
return ("[" + (children.map(genNode).join(',')) + "]" + (checkSkip
|
7693
|
+
? canSkipNormalization(children) ? '' : ',true'
|
7694
|
+
: ''))
|
7695
|
+
}
|
7696
|
+
}
|
7697
|
+
|
7698
|
+
function canSkipNormalization (children) {
|
7699
|
+
for (var i = 0; i < children.length; i++) {
|
7700
|
+
var el = children[i];
|
7701
|
+
if (needsNormalization(el) ||
|
7702
|
+
(el.if && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
|
7703
|
+
return false
|
7704
|
+
}
|
7506
7705
|
}
|
7706
|
+
return true
|
7707
|
+
}
|
7708
|
+
|
7709
|
+
function needsNormalization (el) {
|
7710
|
+
return el.for || el.tag === 'template' || el.tag === 'slot'
|
7507
7711
|
}
|
7508
7712
|
|
7509
7713
|
function genNode (node) {
|
@@ -7515,9 +7719,9 @@ function genNode (node) {
|
|
7515
7719
|
}
|
7516
7720
|
|
7517
7721
|
function genText (text) {
|
7518
|
-
return text.type === 2
|
7722
|
+
return ("_v(" + (text.type === 2
|
7519
7723
|
? text.expression // no need for () because already wrapped in _s()
|
7520
|
-
: transformSpecialNewlines(JSON.stringify(text.text))
|
7724
|
+
: transformSpecialNewlines(JSON.stringify(text.text))) + ")")
|
7521
7725
|
}
|
7522
7726
|
|
7523
7727
|
function genSlot (el) {
|
@@ -7528,8 +7732,8 @@ function genSlot (el) {
|
|
7528
7732
|
|
7529
7733
|
// componentName is el.component, take it as argument to shun flow's pessimistic refinement
|
7530
7734
|
function genComponent (componentName, el) {
|
7531
|
-
var children = el.inlineTemplate ? null : genChildren(el);
|
7532
|
-
return ("
|
7735
|
+
var children = el.inlineTemplate ? null : genChildren(el, true);
|
7736
|
+
return ("_c(" + componentName + "," + (genData(el)) + (children ? ("," + children) : '') + ")")
|
7533
7737
|
}
|
7534
7738
|
|
7535
7739
|
function genProps (props) {
|
@@ -7862,10 +8066,12 @@ function genDefaultModel (
|
|
7862
8066
|
valueExpression = number || type === 'number'
|
7863
8067
|
? ("_n(" + valueExpression + ")")
|
7864
8068
|
: valueExpression;
|
8069
|
+
|
7865
8070
|
var code = genAssignmentCode(value, valueExpression);
|
7866
8071
|
if (isNative && needCompositionGuard) {
|
7867
8072
|
code = "if($event.target.composing)return;" + code;
|
7868
8073
|
}
|
8074
|
+
|
7869
8075
|
// inputs with type="file" are read only and setting the input's
|
7870
8076
|
// value will throw an error.
|
7871
8077
|
if ("development" !== 'production' &&
|
@@ -7875,8 +8081,12 @@ function genDefaultModel (
|
|
7875
8081
|
"File inputs are read only. Use a v-on:change listener instead."
|
7876
8082
|
);
|
7877
8083
|
}
|
8084
|
+
|
7878
8085
|
addProp(el, 'value', isNative ? ("_s(" + value + ")") : ("(" + value + ")"));
|
7879
8086
|
addHandler(el, event, code, null, true);
|
8087
|
+
if (trim || number || type === 'number') {
|
8088
|
+
addHandler(el, 'blur', '$forceUpdate()');
|
8089
|
+
}
|
7880
8090
|
}
|
7881
8091
|
|
7882
8092
|
function genSelect (
|