vue 2.6.7 → 2.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -52
- package/dist/README.md +1 -1
- package/dist/vue.common.dev.js +109 -51
- package/dist/vue.common.prod.js +2 -2
- package/dist/vue.esm.browser.js +109 -51
- package/dist/vue.esm.browser.min.js +2 -2
- package/dist/vue.esm.js +109 -51
- package/dist/vue.js +109 -51
- package/dist/vue.min.js +2 -2
- package/dist/vue.runtime.common.dev.js +80 -38
- package/dist/vue.runtime.common.prod.js +2 -2
- package/dist/vue.runtime.esm.js +80 -38
- package/dist/vue.runtime.js +80 -38
- package/dist/vue.runtime.min.js +2 -2
- package/package.json +4 -4
- package/src/compiler/codegen/events.js +1 -1
- package/src/compiler/codegen/index.js +1 -1
- package/src/compiler/error-detector.js +18 -3
- package/src/compiler/parser/html-parser.js +5 -5
- package/src/compiler/parser/index.js +7 -6
- package/src/core/instance/proxy.js +1 -1
- package/src/core/instance/render-helpers/bind-dynamic-keys.js +1 -1
- package/src/core/instance/render-helpers/bind-object-props.js +5 -3
- package/src/core/instance/render.js +1 -1
- package/src/core/observer/scheduler.js +17 -6
- package/src/core/util/env.js +1 -2
- package/src/core/util/error.js +4 -3
- package/src/core/util/lang.js +2 -2
- package/src/core/util/next-tick.js +1 -1
- package/src/core/util/options.js +2 -2
- package/src/core/vdom/create-element.js +6 -0
- package/src/core/vdom/helpers/normalize-scoped-slots.js +9 -4
- package/src/core/vdom/helpers/resolve-async-component.js +25 -8
- package/src/core/vdom/patch.js +4 -4
- package/src/platforms/web/compiler/modules/model.js +1 -1
- package/src/platforms/web/runtime/modules/dom-props.js +2 -1
- package/src/platforms/web/runtime/modules/events.js +4 -2
- package/src/platforms/web/runtime/modules/transition.js +1 -1
- package/src/server/template-renderer/create-async-file-mapper.js +2 -2
- package/src/server/write.js +1 -1
- package/types/index.d.ts +1 -2
- package/types/options.d.ts +3 -3
- package/types/umd.d.ts +48 -0
- package/types/vnode.d.ts +6 -2
- package/types/vue.d.ts +3 -3
package/dist/vue.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.6.
|
|
2
|
+
* Vue.js v2.6.11
|
|
3
3
|
* (c) 2014-2019 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -475,7 +475,7 @@ var config = ({
|
|
|
475
475
|
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
|
|
476
476
|
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS
|
|
477
477
|
*/
|
|
478
|
-
var
|
|
478
|
+
var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
|
|
479
479
|
|
|
480
480
|
/**
|
|
481
481
|
* Check if a string starts with $ or _
|
|
@@ -500,7 +500,7 @@ function def (obj, key, val, enumerable) {
|
|
|
500
500
|
/**
|
|
501
501
|
* Parse simple path.
|
|
502
502
|
*/
|
|
503
|
-
var bailRE = new RegExp(("[^" +
|
|
503
|
+
var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
|
|
504
504
|
function parsePath (path) {
|
|
505
505
|
if (bailRE.test(path)) {
|
|
506
506
|
return
|
|
@@ -1406,7 +1406,7 @@ function checkComponents (options) {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
|
|
1408
1408
|
function validateComponentName (name) {
|
|
1409
|
-
if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" +
|
|
1409
|
+
if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
|
|
1410
1410
|
warn(
|
|
1411
1411
|
'Invalid component name: "' + name + '". Component names ' +
|
|
1412
1412
|
'should conform to valid custom element name in html5 specification.'
|
|
@@ -1861,10 +1861,11 @@ function invokeWithErrorHandling (
|
|
|
1861
1861
|
var res;
|
|
1862
1862
|
try {
|
|
1863
1863
|
res = args ? handler.apply(context, args) : handler.call(context);
|
|
1864
|
-
if (res && !res._isVue && isPromise(res)) {
|
|
1864
|
+
if (res && !res._isVue && isPromise(res) && !res._handled) {
|
|
1865
|
+
res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
|
|
1865
1866
|
// issue #9511
|
|
1866
|
-
//
|
|
1867
|
-
res =
|
|
1867
|
+
// avoid catch triggering multiple times when nested calls
|
|
1868
|
+
res._handled = true;
|
|
1868
1869
|
}
|
|
1869
1870
|
} catch (e) {
|
|
1870
1871
|
handleError(e, vm, info);
|
|
@@ -1968,7 +1969,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
|
|
1968
1969
|
isUsingMicroTask = true;
|
|
1969
1970
|
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
|
1970
1971
|
// Fallback to setImmediate.
|
|
1971
|
-
//
|
|
1972
|
+
// Technically it leverages the (macro) task queue,
|
|
1972
1973
|
// but it is still a better choice than setTimeout.
|
|
1973
1974
|
timerFunc = function () {
|
|
1974
1975
|
setImmediate(flushCallbacks);
|
|
@@ -2057,7 +2058,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
2057
2058
|
warn(
|
|
2058
2059
|
"Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
|
|
2059
2060
|
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
|
2060
|
-
'prevent conflicts with Vue internals' +
|
|
2061
|
+
'prevent conflicts with Vue internals. ' +
|
|
2061
2062
|
'See: https://vuejs.org/v2/api/#data',
|
|
2062
2063
|
target
|
|
2063
2064
|
);
|
|
@@ -2549,7 +2550,8 @@ function normalizeScopedSlots (
|
|
|
2549
2550
|
prevSlots
|
|
2550
2551
|
) {
|
|
2551
2552
|
var res;
|
|
2552
|
-
var
|
|
2553
|
+
var hasNormalSlots = Object.keys(normalSlots).length > 0;
|
|
2554
|
+
var isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
|
2553
2555
|
var key = slots && slots.$key;
|
|
2554
2556
|
if (!slots) {
|
|
2555
2557
|
res = {};
|
|
@@ -2561,7 +2563,8 @@ function normalizeScopedSlots (
|
|
|
2561
2563
|
prevSlots &&
|
|
2562
2564
|
prevSlots !== emptyObject &&
|
|
2563
2565
|
key === prevSlots.$key &&
|
|
2564
|
-
|
|
2566
|
+
!hasNormalSlots &&
|
|
2567
|
+
!prevSlots.$hasNormal
|
|
2565
2568
|
) {
|
|
2566
2569
|
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
|
2567
2570
|
// only need to normalize once
|
|
@@ -2587,6 +2590,7 @@ function normalizeScopedSlots (
|
|
|
2587
2590
|
}
|
|
2588
2591
|
def(res, '$stable', isStable);
|
|
2589
2592
|
def(res, '$key', key);
|
|
2593
|
+
def(res, '$hasNormal', hasNormalSlots);
|
|
2590
2594
|
return res
|
|
2591
2595
|
}
|
|
2592
2596
|
|
|
@@ -2596,8 +2600,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
|
|
|
2596
2600
|
res = res && typeof res === 'object' && !Array.isArray(res)
|
|
2597
2601
|
? [res] // single vnode
|
|
2598
2602
|
: normalizeChildren(res);
|
|
2599
|
-
return res &&
|
|
2600
|
-
|
|
2603
|
+
return res && (
|
|
2604
|
+
res.length === 0 ||
|
|
2605
|
+
(res.length === 1 && res[0].isComment) // #9658
|
|
2606
|
+
) ? undefined
|
|
2601
2607
|
: res
|
|
2602
2608
|
};
|
|
2603
2609
|
// this is a slot using the new v-slot syntax without scope. although it is
|
|
@@ -2777,12 +2783,13 @@ function bindObjectProps (
|
|
|
2777
2783
|
: data.attrs || (data.attrs = {});
|
|
2778
2784
|
}
|
|
2779
2785
|
var camelizedKey = camelize(key);
|
|
2780
|
-
|
|
2786
|
+
var hyphenatedKey = hyphenate(key);
|
|
2787
|
+
if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
|
|
2781
2788
|
hash[key] = value[key];
|
|
2782
2789
|
|
|
2783
2790
|
if (isSync) {
|
|
2784
2791
|
var on = data.on || (data.on = {});
|
|
2785
|
-
on[("update:" +
|
|
2792
|
+
on[("update:" + key)] = function ($event) {
|
|
2786
2793
|
value[key] = $event;
|
|
2787
2794
|
};
|
|
2788
2795
|
}
|
|
@@ -2913,7 +2920,7 @@ function bindDynamicKeys (baseObj, values) {
|
|
|
2913
2920
|
if (typeof key === 'string' && key) {
|
|
2914
2921
|
baseObj[values[i]] = values[i + 1];
|
|
2915
2922
|
} else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
|
|
2916
|
-
// null is a
|
|
2923
|
+
// null is a special value for explicitly removing a binding
|
|
2917
2924
|
warn(
|
|
2918
2925
|
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
|
2919
2926
|
this
|
|
@@ -3409,6 +3416,12 @@ function _createElement (
|
|
|
3409
3416
|
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
|
3410
3417
|
if (config.isReservedTag(tag)) {
|
|
3411
3418
|
// platform built-in elements
|
|
3419
|
+
if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.nativeOn)) {
|
|
3420
|
+
warn(
|
|
3421
|
+
("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
|
|
3422
|
+
context
|
|
3423
|
+
);
|
|
3424
|
+
}
|
|
3412
3425
|
vnode = new VNode(
|
|
3413
3426
|
config.parsePlatformTagName(tag), data, children,
|
|
3414
3427
|
undefined, undefined, context
|
|
@@ -3537,7 +3550,7 @@ function renderMixin (Vue) {
|
|
|
3537
3550
|
// render self
|
|
3538
3551
|
var vnode;
|
|
3539
3552
|
try {
|
|
3540
|
-
// There's no need to maintain a stack
|
|
3553
|
+
// There's no need to maintain a stack because all render fns are called
|
|
3541
3554
|
// separately from one another. Nested component's render fns are called
|
|
3542
3555
|
// when parent component is patched.
|
|
3543
3556
|
currentRenderingInstance = vm;
|
|
@@ -3620,17 +3633,23 @@ function resolveAsyncComponent (
|
|
|
3620
3633
|
return factory.resolved
|
|
3621
3634
|
}
|
|
3622
3635
|
|
|
3636
|
+
var owner = currentRenderingInstance;
|
|
3637
|
+
if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
|
3638
|
+
// already pending
|
|
3639
|
+
factory.owners.push(owner);
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3623
3642
|
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
|
3624
3643
|
return factory.loadingComp
|
|
3625
3644
|
}
|
|
3626
3645
|
|
|
3627
|
-
|
|
3628
|
-
if (isDef(factory.owners)) {
|
|
3629
|
-
// already pending
|
|
3630
|
-
factory.owners.push(owner);
|
|
3631
|
-
} else {
|
|
3646
|
+
if (owner && !isDef(factory.owners)) {
|
|
3632
3647
|
var owners = factory.owners = [owner];
|
|
3633
3648
|
var sync = true;
|
|
3649
|
+
var timerLoading = null;
|
|
3650
|
+
var timerTimeout = null
|
|
3651
|
+
|
|
3652
|
+
;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
|
|
3634
3653
|
|
|
3635
3654
|
var forceRender = function (renderCompleted) {
|
|
3636
3655
|
for (var i = 0, l = owners.length; i < l; i++) {
|
|
@@ -3639,6 +3658,14 @@ function resolveAsyncComponent (
|
|
|
3639
3658
|
|
|
3640
3659
|
if (renderCompleted) {
|
|
3641
3660
|
owners.length = 0;
|
|
3661
|
+
if (timerLoading !== null) {
|
|
3662
|
+
clearTimeout(timerLoading);
|
|
3663
|
+
timerLoading = null;
|
|
3664
|
+
}
|
|
3665
|
+
if (timerTimeout !== null) {
|
|
3666
|
+
clearTimeout(timerTimeout);
|
|
3667
|
+
timerTimeout = null;
|
|
3668
|
+
}
|
|
3642
3669
|
}
|
|
3643
3670
|
};
|
|
3644
3671
|
|
|
@@ -3685,7 +3712,8 @@ function resolveAsyncComponent (
|
|
|
3685
3712
|
if (res.delay === 0) {
|
|
3686
3713
|
factory.loading = true;
|
|
3687
3714
|
} else {
|
|
3688
|
-
setTimeout(function () {
|
|
3715
|
+
timerLoading = setTimeout(function () {
|
|
3716
|
+
timerLoading = null;
|
|
3689
3717
|
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
|
3690
3718
|
factory.loading = true;
|
|
3691
3719
|
forceRender(false);
|
|
@@ -3695,7 +3723,8 @@ function resolveAsyncComponent (
|
|
|
3695
3723
|
}
|
|
3696
3724
|
|
|
3697
3725
|
if (isDef(res.timeout)) {
|
|
3698
|
-
setTimeout(function () {
|
|
3726
|
+
timerTimeout = setTimeout(function () {
|
|
3727
|
+
timerTimeout = null;
|
|
3699
3728
|
if (isUndef(factory.resolved)) {
|
|
3700
3729
|
reject(
|
|
3701
3730
|
process.env.NODE_ENV !== 'production'
|
|
@@ -4243,11 +4272,21 @@ var getNow = Date.now;
|
|
|
4243
4272
|
// timestamp can either be hi-res (relative to page load) or low-res
|
|
4244
4273
|
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
4245
4274
|
// same timestamp type when saving the flush timestamp.
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4275
|
+
// All IE versions use low-res event timestamps, and have problematic clock
|
|
4276
|
+
// implementations (#9632)
|
|
4277
|
+
if (inBrowser && !isIE) {
|
|
4278
|
+
var performance = window.performance;
|
|
4279
|
+
if (
|
|
4280
|
+
performance &&
|
|
4281
|
+
typeof performance.now === 'function' &&
|
|
4282
|
+
getNow() > document.createEvent('Event').timeStamp
|
|
4283
|
+
) {
|
|
4284
|
+
// if the event timestamp, although evaluated AFTER the Date.now(), is
|
|
4285
|
+
// smaller than it, it means the event is using a hi-res timestamp,
|
|
4286
|
+
// and we need to use the hi-res version for event listener timestamps as
|
|
4287
|
+
// well.
|
|
4288
|
+
getNow = function () { return performance.now(); };
|
|
4289
|
+
}
|
|
4251
4290
|
}
|
|
4252
4291
|
|
|
4253
4292
|
/**
|
|
@@ -5420,7 +5459,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
|
|
5420
5459
|
value: FunctionalRenderContext
|
|
5421
5460
|
});
|
|
5422
5461
|
|
|
5423
|
-
Vue.version = '2.6.
|
|
5462
|
+
Vue.version = '2.6.11';
|
|
5424
5463
|
|
|
5425
5464
|
/* */
|
|
5426
5465
|
|
|
@@ -6093,7 +6132,7 @@ function createPatchFunction (backend) {
|
|
|
6093
6132
|
}
|
|
6094
6133
|
}
|
|
6095
6134
|
|
|
6096
|
-
function removeVnodes (
|
|
6135
|
+
function removeVnodes (vnodes, startIdx, endIdx) {
|
|
6097
6136
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
6098
6137
|
var ch = vnodes[startIdx];
|
|
6099
6138
|
if (isDef(ch)) {
|
|
@@ -6204,7 +6243,7 @@ function createPatchFunction (backend) {
|
|
|
6204
6243
|
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
|
6205
6244
|
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
|
6206
6245
|
} else if (newStartIdx > newEndIdx) {
|
|
6207
|
-
removeVnodes(
|
|
6246
|
+
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
6208
6247
|
}
|
|
6209
6248
|
}
|
|
6210
6249
|
|
|
@@ -6296,7 +6335,7 @@ function createPatchFunction (backend) {
|
|
|
6296
6335
|
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
|
|
6297
6336
|
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
|
6298
6337
|
} else if (isDef(oldCh)) {
|
|
6299
|
-
removeVnodes(
|
|
6338
|
+
removeVnodes(oldCh, 0, oldCh.length - 1);
|
|
6300
6339
|
} else if (isDef(oldVnode.text)) {
|
|
6301
6340
|
nodeOps.setTextContent(elm, '');
|
|
6302
6341
|
}
|
|
@@ -6527,7 +6566,7 @@ function createPatchFunction (backend) {
|
|
|
6527
6566
|
|
|
6528
6567
|
// destroy old node
|
|
6529
6568
|
if (isDef(parentElm)) {
|
|
6530
|
-
removeVnodes(
|
|
6569
|
+
removeVnodes([oldVnode], 0, 0);
|
|
6531
6570
|
} else if (isDef(oldVnode.tag)) {
|
|
6532
6571
|
invokeDestroyHook(oldVnode);
|
|
6533
6572
|
}
|
|
@@ -7514,8 +7553,10 @@ function add$1 (
|
|
|
7514
7553
|
e.target === e.currentTarget ||
|
|
7515
7554
|
// event is fired after handler attachment
|
|
7516
7555
|
e.timeStamp >= attachedTimestamp ||
|
|
7517
|
-
//
|
|
7518
|
-
|
|
7556
|
+
// bail for environments that have buggy event.timeStamp implementations
|
|
7557
|
+
// #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
|
|
7558
|
+
// #9681 QtWebEngine event.timeStamp is negative value
|
|
7559
|
+
e.timeStamp <= 0 ||
|
|
7519
7560
|
// #9448 bail if event is fired in another document in a multi-page
|
|
7520
7561
|
// electron/nw.js app, since event.timeStamp will be using a different
|
|
7521
7562
|
// starting reference
|
|
@@ -7582,10 +7623,11 @@ function updateDOMProps (oldVnode, vnode) {
|
|
|
7582
7623
|
}
|
|
7583
7624
|
|
|
7584
7625
|
for (key in oldProps) {
|
|
7585
|
-
if (
|
|
7626
|
+
if (!(key in props)) {
|
|
7586
7627
|
elm[key] = '';
|
|
7587
7628
|
}
|
|
7588
7629
|
}
|
|
7630
|
+
|
|
7589
7631
|
for (key in props) {
|
|
7590
7632
|
cur = props[key];
|
|
7591
7633
|
// ignore children if the node has textContent or innerHTML,
|
|
@@ -8133,8 +8175,8 @@ function enter (vnode, toggleDisplay) {
|
|
|
8133
8175
|
var context = activeInstance;
|
|
8134
8176
|
var transitionNode = activeInstance.$vnode;
|
|
8135
8177
|
while (transitionNode && transitionNode.parent) {
|
|
8136
|
-
transitionNode = transitionNode.parent;
|
|
8137
8178
|
context = transitionNode.context;
|
|
8179
|
+
transitionNode = transitionNode.parent;
|
|
8138
8180
|
}
|
|
8139
8181
|
|
|
8140
8182
|
var isAppear = !context._isMounted || !vnode.isRootInsert;
|
|
@@ -9230,13 +9272,13 @@ var isNonPhrasingTag = makeMap(
|
|
|
9230
9272
|
// Regular Expressions for parsing tags and attributes
|
|
9231
9273
|
var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
|
9232
9274
|
var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
|
9233
|
-
var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" +
|
|
9275
|
+
var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
|
|
9234
9276
|
var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
|
|
9235
9277
|
var startTagOpen = new RegExp(("^<" + qnameCapture));
|
|
9236
9278
|
var startTagClose = /^\s*(\/?)>/;
|
|
9237
9279
|
var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
|
|
9238
9280
|
var doctype = /^<!DOCTYPE [^>]+>/i;
|
|
9239
|
-
// #7298: escape - to avoid being
|
|
9281
|
+
// #7298: escape - to avoid being passed as HTML comment when inlined in page
|
|
9240
9282
|
var comment = /^<!\--/;
|
|
9241
9283
|
var conditionalComment = /^<!\[/;
|
|
9242
9284
|
|
|
@@ -9493,7 +9535,7 @@ function parseHTML (html, options) {
|
|
|
9493
9535
|
) {
|
|
9494
9536
|
options.warn(
|
|
9495
9537
|
("tag <" + (stack[i].tag) + "> has no matching end tag."),
|
|
9496
|
-
{ start: stack[i].start }
|
|
9538
|
+
{ start: stack[i].start, end: stack[i].end }
|
|
9497
9539
|
);
|
|
9498
9540
|
}
|
|
9499
9541
|
if (options.end) {
|
|
@@ -9522,7 +9564,7 @@ function parseHTML (html, options) {
|
|
|
9522
9564
|
/* */
|
|
9523
9565
|
|
|
9524
9566
|
var onRE = /^@|^v-on:/;
|
|
9525
|
-
var dirRE = /^v
|
|
9567
|
+
var dirRE = /^v-|^@|^:|^#/;
|
|
9526
9568
|
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
9527
9569
|
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
|
9528
9570
|
var stripParensRE = /^\(|\)$/g;
|
|
@@ -9530,7 +9572,7 @@ var dynamicArgRE = /^\[.*\]$/;
|
|
|
9530
9572
|
|
|
9531
9573
|
var argRE = /:(.*)$/;
|
|
9532
9574
|
var bindRE = /^:|^\.|^v-bind:/;
|
|
9533
|
-
var modifierRE = /\.[
|
|
9575
|
+
var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
|
|
9534
9576
|
|
|
9535
9577
|
var slotRE = /^v-slot(:|$)|^#/;
|
|
9536
9578
|
|
|
@@ -9707,7 +9749,7 @@ function parse (
|
|
|
9707
9749
|
shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
|
|
9708
9750
|
shouldKeepComment: options.comments,
|
|
9709
9751
|
outputSourceRange: options.outputSourceRange,
|
|
9710
|
-
start: function start (tag, attrs, unary, start$1) {
|
|
9752
|
+
start: function start (tag, attrs, unary, start$1, end) {
|
|
9711
9753
|
// check namespace.
|
|
9712
9754
|
// inherit parent ns if there is one
|
|
9713
9755
|
var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
|
|
@@ -9726,6 +9768,7 @@ function parse (
|
|
|
9726
9768
|
if (process.env.NODE_ENV !== 'production') {
|
|
9727
9769
|
if (options.outputSourceRange) {
|
|
9728
9770
|
element.start = start$1;
|
|
9771
|
+
element.end = end;
|
|
9729
9772
|
element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
|
|
9730
9773
|
cumulated[attr.name] = attr;
|
|
9731
9774
|
return cumulated
|
|
@@ -9847,7 +9890,7 @@ function parse (
|
|
|
9847
9890
|
text = preserveWhitespace ? ' ' : '';
|
|
9848
9891
|
}
|
|
9849
9892
|
if (text) {
|
|
9850
|
-
if (whitespaceOption === 'condense') {
|
|
9893
|
+
if (!inPre && whitespaceOption === 'condense') {
|
|
9851
9894
|
// condense consecutive whitespaces into single space
|
|
9852
9895
|
text = text.replace(whitespaceRE$1, ' ');
|
|
9853
9896
|
}
|
|
@@ -10145,7 +10188,7 @@ function processSlotContent (el) {
|
|
|
10145
10188
|
if (el.parent && !maybeComponent(el.parent)) {
|
|
10146
10189
|
warn$2(
|
|
10147
10190
|
"<template v-slot> can only appear at the root level inside " +
|
|
10148
|
-
"the receiving
|
|
10191
|
+
"the receiving component",
|
|
10149
10192
|
el
|
|
10150
10193
|
);
|
|
10151
10194
|
}
|
|
@@ -10710,7 +10753,7 @@ function isDirectChildOfTemplateFor (node) {
|
|
|
10710
10753
|
|
|
10711
10754
|
/* */
|
|
10712
10755
|
|
|
10713
|
-
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
|
|
10756
|
+
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
|
|
10714
10757
|
var fnInvokeRE = /\([^)]*?\);*$/;
|
|
10715
10758
|
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
|
10716
10759
|
|
|
@@ -11215,7 +11258,7 @@ function genScopedSlots (
|
|
|
11215
11258
|
// components with only scoped slots to skip forced updates from parent.
|
|
11216
11259
|
// but in some cases we have to bail-out of this optimization
|
|
11217
11260
|
// for example if the slot contains dynamic names, has v-if or v-for on them...
|
|
11218
|
-
var needsForceUpdate = Object.keys(slots).some(function (key) {
|
|
11261
|
+
var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
|
|
11219
11262
|
var slot = slots[key];
|
|
11220
11263
|
return (
|
|
11221
11264
|
slot.slotTargetDynamic ||
|
|
@@ -11482,6 +11525,8 @@ function checkNode (node, warn) {
|
|
|
11482
11525
|
var range = node.rawAttrsMap[name];
|
|
11483
11526
|
if (name === 'v-for') {
|
|
11484
11527
|
checkFor(node, ("v-for=\"" + value + "\""), warn, range);
|
|
11528
|
+
} else if (name === 'v-slot' || name[0] === '#') {
|
|
11529
|
+
checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
|
|
11485
11530
|
} else if (onRE.test(name)) {
|
|
11486
11531
|
checkEvent(value, (name + "=\"" + value + "\""), warn, range);
|
|
11487
11532
|
} else {
|
|
@@ -11501,9 +11546,9 @@ function checkNode (node, warn) {
|
|
|
11501
11546
|
}
|
|
11502
11547
|
|
|
11503
11548
|
function checkEvent (exp, text, warn, range) {
|
|
11504
|
-
var
|
|
11505
|
-
var keywordMatch =
|
|
11506
|
-
if (keywordMatch &&
|
|
11549
|
+
var stripped = exp.replace(stripStringRE, '');
|
|
11550
|
+
var keywordMatch = stripped.match(unaryOperatorsRE);
|
|
11551
|
+
if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
|
|
11507
11552
|
warn(
|
|
11508
11553
|
"avoid using JavaScript unary operator as property name: " +
|
|
11509
11554
|
"\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
|
|
@@ -11558,6 +11603,19 @@ function checkExpression (exp, text, warn, range) {
|
|
|
11558
11603
|
}
|
|
11559
11604
|
}
|
|
11560
11605
|
|
|
11606
|
+
function checkFunctionParameterExpression (exp, text, warn, range) {
|
|
11607
|
+
try {
|
|
11608
|
+
new Function(exp, '');
|
|
11609
|
+
} catch (e) {
|
|
11610
|
+
warn(
|
|
11611
|
+
"invalid function parameter expression: " + (e.message) + " in\n\n" +
|
|
11612
|
+
" " + exp + "\n\n" +
|
|
11613
|
+
" Raw expression: " + (text.trim()) + "\n",
|
|
11614
|
+
range
|
|
11615
|
+
);
|
|
11616
|
+
}
|
|
11617
|
+
}
|
|
11618
|
+
|
|
11561
11619
|
/* */
|
|
11562
11620
|
|
|
11563
11621
|
var range = 2;
|