vue 2.6.8 → 2.6.12
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 +61 -81
- package/dist/README.md +3 -5
- package/dist/vue.common.dev.js +97 -44
- package/dist/vue.common.prod.js +3 -3
- package/dist/vue.esm.browser.js +97 -44
- package/dist/vue.esm.browser.min.js +3 -3
- package/dist/vue.esm.js +97 -44
- package/dist/vue.js +97 -44
- package/dist/vue.min.js +3 -3
- package/dist/vue.runtime.common.dev.js +73 -35
- package/dist/vue.runtime.common.prod.js +3 -3
- package/dist/vue.runtime.esm.js +73 -35
- package/dist/vue.runtime.js +73 -35
- package/dist/vue.runtime.min.js +3 -3
- package/package.json +4 -4
- package/src/compiler/codegen/events.js +1 -1
- package/src/compiler/error-detector.js +18 -3
- package/src/compiler/parser/html-parser.js +2 -2
- package/src/compiler/parser/index.js +5 -5
- package/src/core/instance/proxy.js +1 -1
- package/src/core/instance/render-helpers/bind-dynamic-keys.js +2 -2
- 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/next-tick.js +1 -1
- 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 +16 -4
- 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 +3 -2
- package/src/platforms/web/runtime/modules/events.js +4 -2
- package/src/platforms/web/runtime/modules/transition.js +1 -1
- package/src/platforms/web/server/util.js +4 -4
- package/src/server/template-renderer/create-async-file-mapper.js +2 -2
- 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 +1 -1
- package/types/vue.d.ts +1 -1
package/dist/vue.esm.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.6.
|
|
3
|
-
* (c) 2014-
|
|
2
|
+
* Vue.js v2.6.12
|
|
3
|
+
* (c) 2014-2020 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
/* */
|
|
@@ -1888,10 +1888,11 @@ function invokeWithErrorHandling (
|
|
|
1888
1888
|
let res;
|
|
1889
1889
|
try {
|
|
1890
1890
|
res = args ? handler.apply(context, args) : handler.call(context);
|
|
1891
|
-
if (res && !res._isVue && isPromise(res)) {
|
|
1891
|
+
if (res && !res._isVue && isPromise(res) && !res._handled) {
|
|
1892
|
+
res.catch(e => handleError(e, vm, info + ` (Promise/async)`));
|
|
1892
1893
|
// issue #9511
|
|
1893
|
-
//
|
|
1894
|
-
res =
|
|
1894
|
+
// avoid catch triggering multiple times when nested calls
|
|
1895
|
+
res._handled = true;
|
|
1895
1896
|
}
|
|
1896
1897
|
} catch (e) {
|
|
1897
1898
|
handleError(e, vm, info);
|
|
@@ -1995,7 +1996,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
|
|
1995
1996
|
isUsingMicroTask = true;
|
|
1996
1997
|
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
|
1997
1998
|
// Fallback to setImmediate.
|
|
1998
|
-
//
|
|
1999
|
+
// Technically it leverages the (macro) task queue,
|
|
1999
2000
|
// but it is still a better choice than setTimeout.
|
|
2000
2001
|
timerFunc = () => {
|
|
2001
2002
|
setImmediate(flushCallbacks);
|
|
@@ -2084,7 +2085,7 @@ let initProxy;
|
|
|
2084
2085
|
warn(
|
|
2085
2086
|
`Property "${key}" must be accessed with "$data.${key}" because ` +
|
|
2086
2087
|
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
|
2087
|
-
'prevent conflicts with Vue internals' +
|
|
2088
|
+
'prevent conflicts with Vue internals. ' +
|
|
2088
2089
|
'See: https://vuejs.org/v2/api/#data',
|
|
2089
2090
|
target
|
|
2090
2091
|
);
|
|
@@ -2571,7 +2572,8 @@ function normalizeScopedSlots (
|
|
|
2571
2572
|
prevSlots
|
|
2572
2573
|
) {
|
|
2573
2574
|
let res;
|
|
2574
|
-
const
|
|
2575
|
+
const hasNormalSlots = Object.keys(normalSlots).length > 0;
|
|
2576
|
+
const isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
|
2575
2577
|
const key = slots && slots.$key;
|
|
2576
2578
|
if (!slots) {
|
|
2577
2579
|
res = {};
|
|
@@ -2583,7 +2585,8 @@ function normalizeScopedSlots (
|
|
|
2583
2585
|
prevSlots &&
|
|
2584
2586
|
prevSlots !== emptyObject &&
|
|
2585
2587
|
key === prevSlots.$key &&
|
|
2586
|
-
|
|
2588
|
+
!hasNormalSlots &&
|
|
2589
|
+
!prevSlots.$hasNormal
|
|
2587
2590
|
) {
|
|
2588
2591
|
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
|
2589
2592
|
// only need to normalize once
|
|
@@ -2609,6 +2612,7 @@ function normalizeScopedSlots (
|
|
|
2609
2612
|
}
|
|
2610
2613
|
def(res, '$stable', isStable);
|
|
2611
2614
|
def(res, '$key', key);
|
|
2615
|
+
def(res, '$hasNormal', hasNormalSlots);
|
|
2612
2616
|
return res
|
|
2613
2617
|
}
|
|
2614
2618
|
|
|
@@ -2618,8 +2622,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
|
|
|
2618
2622
|
res = res && typeof res === 'object' && !Array.isArray(res)
|
|
2619
2623
|
? [res] // single vnode
|
|
2620
2624
|
: normalizeChildren(res);
|
|
2621
|
-
return res &&
|
|
2622
|
-
|
|
2625
|
+
return res && (
|
|
2626
|
+
res.length === 0 ||
|
|
2627
|
+
(res.length === 1 && res[0].isComment) // #9658
|
|
2628
|
+
) ? undefined
|
|
2623
2629
|
: res
|
|
2624
2630
|
};
|
|
2625
2631
|
// this is a slot using the new v-slot syntax without scope. although it is
|
|
@@ -2799,12 +2805,13 @@ function bindObjectProps (
|
|
|
2799
2805
|
: data.attrs || (data.attrs = {});
|
|
2800
2806
|
}
|
|
2801
2807
|
const camelizedKey = camelize(key);
|
|
2802
|
-
|
|
2808
|
+
const hyphenatedKey = hyphenate(key);
|
|
2809
|
+
if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
|
|
2803
2810
|
hash[key] = value[key];
|
|
2804
2811
|
|
|
2805
2812
|
if (isSync) {
|
|
2806
2813
|
const on = data.on || (data.on = {});
|
|
2807
|
-
on[`update:${
|
|
2814
|
+
on[`update:${key}`] = function ($event) {
|
|
2808
2815
|
value[key] = $event;
|
|
2809
2816
|
};
|
|
2810
2817
|
}
|
|
@@ -2933,7 +2940,7 @@ function bindDynamicKeys (baseObj, values) {
|
|
|
2933
2940
|
if (typeof key === 'string' && key) {
|
|
2934
2941
|
baseObj[values[i]] = values[i + 1];
|
|
2935
2942
|
} else if (key !== '' && key !== null) {
|
|
2936
|
-
// null is a
|
|
2943
|
+
// null is a special value for explicitly removing a binding
|
|
2937
2944
|
warn(
|
|
2938
2945
|
`Invalid value for dynamic directive argument (expected string or null): ${key}`,
|
|
2939
2946
|
this
|
|
@@ -3425,6 +3432,12 @@ function _createElement (
|
|
|
3425
3432
|
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
|
3426
3433
|
if (config.isReservedTag(tag)) {
|
|
3427
3434
|
// platform built-in elements
|
|
3435
|
+
if (isDef(data) && isDef(data.nativeOn)) {
|
|
3436
|
+
warn(
|
|
3437
|
+
`The .native modifier for v-on is only valid on components but it was used on <${tag}>.`,
|
|
3438
|
+
context
|
|
3439
|
+
);
|
|
3440
|
+
}
|
|
3428
3441
|
vnode = new VNode(
|
|
3429
3442
|
config.parsePlatformTagName(tag), data, children,
|
|
3430
3443
|
undefined, undefined, context
|
|
@@ -3548,7 +3561,7 @@ function renderMixin (Vue) {
|
|
|
3548
3561
|
// render self
|
|
3549
3562
|
let vnode;
|
|
3550
3563
|
try {
|
|
3551
|
-
// There's no need to maintain a stack
|
|
3564
|
+
// There's no need to maintain a stack because all render fns are called
|
|
3552
3565
|
// separately from one another. Nested component's render fns are called
|
|
3553
3566
|
// when parent component is patched.
|
|
3554
3567
|
currentRenderingInstance = vm;
|
|
@@ -3632,7 +3645,7 @@ function resolveAsyncComponent (
|
|
|
3632
3645
|
}
|
|
3633
3646
|
|
|
3634
3647
|
const owner = currentRenderingInstance;
|
|
3635
|
-
if (isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
|
3648
|
+
if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
|
3636
3649
|
// already pending
|
|
3637
3650
|
factory.owners.push(owner);
|
|
3638
3651
|
}
|
|
@@ -3641,9 +3654,11 @@ function resolveAsyncComponent (
|
|
|
3641
3654
|
return factory.loadingComp
|
|
3642
3655
|
}
|
|
3643
3656
|
|
|
3644
|
-
if (!isDef(factory.owners)) {
|
|
3657
|
+
if (owner && !isDef(factory.owners)) {
|
|
3645
3658
|
const owners = factory.owners = [owner];
|
|
3646
|
-
let sync = true
|
|
3659
|
+
let sync = true;
|
|
3660
|
+
let timerLoading = null;
|
|
3661
|
+
let timerTimeout = null
|
|
3647
3662
|
|
|
3648
3663
|
;(owner).$on('hook:destroyed', () => remove(owners, owner));
|
|
3649
3664
|
|
|
@@ -3654,6 +3669,14 @@ function resolveAsyncComponent (
|
|
|
3654
3669
|
|
|
3655
3670
|
if (renderCompleted) {
|
|
3656
3671
|
owners.length = 0;
|
|
3672
|
+
if (timerLoading !== null) {
|
|
3673
|
+
clearTimeout(timerLoading);
|
|
3674
|
+
timerLoading = null;
|
|
3675
|
+
}
|
|
3676
|
+
if (timerTimeout !== null) {
|
|
3677
|
+
clearTimeout(timerTimeout);
|
|
3678
|
+
timerTimeout = null;
|
|
3679
|
+
}
|
|
3657
3680
|
}
|
|
3658
3681
|
};
|
|
3659
3682
|
|
|
@@ -3700,7 +3723,8 @@ function resolveAsyncComponent (
|
|
|
3700
3723
|
if (res.delay === 0) {
|
|
3701
3724
|
factory.loading = true;
|
|
3702
3725
|
} else {
|
|
3703
|
-
setTimeout(() => {
|
|
3726
|
+
timerLoading = setTimeout(() => {
|
|
3727
|
+
timerLoading = null;
|
|
3704
3728
|
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
|
3705
3729
|
factory.loading = true;
|
|
3706
3730
|
forceRender(false);
|
|
@@ -3710,7 +3734,8 @@ function resolveAsyncComponent (
|
|
|
3710
3734
|
}
|
|
3711
3735
|
|
|
3712
3736
|
if (isDef(res.timeout)) {
|
|
3713
|
-
setTimeout(() => {
|
|
3737
|
+
timerTimeout = setTimeout(() => {
|
|
3738
|
+
timerTimeout = null;
|
|
3714
3739
|
if (isUndef(factory.resolved)) {
|
|
3715
3740
|
reject(
|
|
3716
3741
|
`timeout (${res.timeout}ms)`
|
|
@@ -4256,11 +4281,21 @@ let getNow = Date.now;
|
|
|
4256
4281
|
// timestamp can either be hi-res (relative to page load) or low-res
|
|
4257
4282
|
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
4258
4283
|
// same timestamp type when saving the flush timestamp.
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4284
|
+
// All IE versions use low-res event timestamps, and have problematic clock
|
|
4285
|
+
// implementations (#9632)
|
|
4286
|
+
if (inBrowser && !isIE) {
|
|
4287
|
+
const performance = window.performance;
|
|
4288
|
+
if (
|
|
4289
|
+
performance &&
|
|
4290
|
+
typeof performance.now === 'function' &&
|
|
4291
|
+
getNow() > document.createEvent('Event').timeStamp
|
|
4292
|
+
) {
|
|
4293
|
+
// if the event timestamp, although evaluated AFTER the Date.now(), is
|
|
4294
|
+
// smaller than it, it means the event is using a hi-res timestamp,
|
|
4295
|
+
// and we need to use the hi-res version for event listener timestamps as
|
|
4296
|
+
// well.
|
|
4297
|
+
getNow = () => performance.now();
|
|
4298
|
+
}
|
|
4264
4299
|
}
|
|
4265
4300
|
|
|
4266
4301
|
/**
|
|
@@ -5435,7 +5470,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
|
|
5435
5470
|
value: FunctionalRenderContext
|
|
5436
5471
|
});
|
|
5437
5472
|
|
|
5438
|
-
Vue.version = '2.6.
|
|
5473
|
+
Vue.version = '2.6.12';
|
|
5439
5474
|
|
|
5440
5475
|
/* */
|
|
5441
5476
|
|
|
@@ -6107,7 +6142,7 @@ function createPatchFunction (backend) {
|
|
|
6107
6142
|
}
|
|
6108
6143
|
}
|
|
6109
6144
|
|
|
6110
|
-
function removeVnodes (
|
|
6145
|
+
function removeVnodes (vnodes, startIdx, endIdx) {
|
|
6111
6146
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
6112
6147
|
const ch = vnodes[startIdx];
|
|
6113
6148
|
if (isDef(ch)) {
|
|
@@ -6218,7 +6253,7 @@ function createPatchFunction (backend) {
|
|
|
6218
6253
|
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
|
6219
6254
|
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
|
6220
6255
|
} else if (newStartIdx > newEndIdx) {
|
|
6221
|
-
removeVnodes(
|
|
6256
|
+
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
6222
6257
|
}
|
|
6223
6258
|
}
|
|
6224
6259
|
|
|
@@ -6310,7 +6345,7 @@ function createPatchFunction (backend) {
|
|
|
6310
6345
|
if (isDef(oldVnode.text)) nodeOps.setTextContent(elm, '');
|
|
6311
6346
|
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
|
6312
6347
|
} else if (isDef(oldCh)) {
|
|
6313
|
-
removeVnodes(
|
|
6348
|
+
removeVnodes(oldCh, 0, oldCh.length - 1);
|
|
6314
6349
|
} else if (isDef(oldVnode.text)) {
|
|
6315
6350
|
nodeOps.setTextContent(elm, '');
|
|
6316
6351
|
}
|
|
@@ -6537,7 +6572,7 @@ function createPatchFunction (backend) {
|
|
|
6537
6572
|
|
|
6538
6573
|
// destroy old node
|
|
6539
6574
|
if (isDef(parentElm)) {
|
|
6540
|
-
removeVnodes(
|
|
6575
|
+
removeVnodes([oldVnode], 0, 0);
|
|
6541
6576
|
} else if (isDef(oldVnode.tag)) {
|
|
6542
6577
|
invokeDestroyHook(oldVnode);
|
|
6543
6578
|
}
|
|
@@ -7519,8 +7554,10 @@ function add$1 (
|
|
|
7519
7554
|
e.target === e.currentTarget ||
|
|
7520
7555
|
// event is fired after handler attachment
|
|
7521
7556
|
e.timeStamp >= attachedTimestamp ||
|
|
7522
|
-
//
|
|
7523
|
-
|
|
7557
|
+
// bail for environments that have buggy event.timeStamp implementations
|
|
7558
|
+
// #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
|
|
7559
|
+
// #9681 QtWebEngine event.timeStamp is negative value
|
|
7560
|
+
e.timeStamp <= 0 ||
|
|
7524
7561
|
// #9448 bail if event is fired in another document in a multi-page
|
|
7525
7562
|
// electron/nw.js app, since event.timeStamp will be using a different
|
|
7526
7563
|
// starting reference
|
|
@@ -7587,10 +7624,11 @@ function updateDOMProps (oldVnode, vnode) {
|
|
|
7587
7624
|
}
|
|
7588
7625
|
|
|
7589
7626
|
for (key in oldProps) {
|
|
7590
|
-
if (
|
|
7627
|
+
if (!(key in props)) {
|
|
7591
7628
|
elm[key] = '';
|
|
7592
7629
|
}
|
|
7593
7630
|
}
|
|
7631
|
+
|
|
7594
7632
|
for (key in props) {
|
|
7595
7633
|
cur = props[key];
|
|
7596
7634
|
// ignore children if the node has textContent or innerHTML,
|
|
@@ -7630,7 +7668,7 @@ function updateDOMProps (oldVnode, vnode) {
|
|
|
7630
7668
|
// skip the update if old and new VDOM state is the same.
|
|
7631
7669
|
// `value` is handled separately because the DOM value may be temporarily
|
|
7632
7670
|
// out of sync with VDOM state due to focus, composition and modifiers.
|
|
7633
|
-
// This #4521 by skipping the
|
|
7671
|
+
// This #4521 by skipping the unnecessary `checked` update.
|
|
7634
7672
|
cur !== oldProps[key]
|
|
7635
7673
|
) {
|
|
7636
7674
|
// some property updates can throw
|
|
@@ -8137,8 +8175,8 @@ function enter (vnode, toggleDisplay) {
|
|
|
8137
8175
|
let context = activeInstance;
|
|
8138
8176
|
let transitionNode = activeInstance.$vnode;
|
|
8139
8177
|
while (transitionNode && transitionNode.parent) {
|
|
8140
|
-
transitionNode = transitionNode.parent;
|
|
8141
8178
|
context = transitionNode.context;
|
|
8179
|
+
transitionNode = transitionNode.parent;
|
|
8142
8180
|
}
|
|
8143
8181
|
|
|
8144
8182
|
const isAppear = !context._isMounted || !vnode.isRootInsert;
|
|
@@ -9229,7 +9267,7 @@ const startTagOpen = new RegExp(`^<${qnameCapture}`);
|
|
|
9229
9267
|
const startTagClose = /^\s*(\/?)>/;
|
|
9230
9268
|
const endTag = new RegExp(`^<\\/${qnameCapture}[^>]*>`);
|
|
9231
9269
|
const doctype = /^<!DOCTYPE [^>]+>/i;
|
|
9232
|
-
// #7298: escape - to avoid being
|
|
9270
|
+
// #7298: escape - to avoid being passed as HTML comment when inlined in page
|
|
9233
9271
|
const comment = /^<!\--/;
|
|
9234
9272
|
const conditionalComment = /^<!\[/;
|
|
9235
9273
|
|
|
@@ -9514,7 +9552,7 @@ function parseHTML (html, options) {
|
|
|
9514
9552
|
/* */
|
|
9515
9553
|
|
|
9516
9554
|
const onRE = /^@|^v-on:/;
|
|
9517
|
-
const dirRE = /^v
|
|
9555
|
+
const dirRE = /^v-|^@|^:|^#/;
|
|
9518
9556
|
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
9519
9557
|
const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
|
9520
9558
|
const stripParensRE = /^\(|\)$/g;
|
|
@@ -9840,7 +9878,7 @@ function parse (
|
|
|
9840
9878
|
text = preserveWhitespace ? ' ' : '';
|
|
9841
9879
|
}
|
|
9842
9880
|
if (text) {
|
|
9843
|
-
if (whitespaceOption === 'condense') {
|
|
9881
|
+
if (!inPre && whitespaceOption === 'condense') {
|
|
9844
9882
|
// condense consecutive whitespaces into single space
|
|
9845
9883
|
text = text.replace(whitespaceRE$1, ' ');
|
|
9846
9884
|
}
|
|
@@ -9869,7 +9907,7 @@ function parse (
|
|
|
9869
9907
|
}
|
|
9870
9908
|
},
|
|
9871
9909
|
comment (text, start, end) {
|
|
9872
|
-
// adding
|
|
9910
|
+
// adding anything as a sibling to the root node is forbidden
|
|
9873
9911
|
// comments should still be allowed, but ignored
|
|
9874
9912
|
if (currentParent) {
|
|
9875
9913
|
const child = {
|
|
@@ -10138,7 +10176,7 @@ function processSlotContent (el) {
|
|
|
10138
10176
|
if (el.parent && !maybeComponent(el.parent)) {
|
|
10139
10177
|
warn$2(
|
|
10140
10178
|
`<template v-slot> can only appear at the root level inside ` +
|
|
10141
|
-
`the receiving
|
|
10179
|
+
`the receiving component`,
|
|
10142
10180
|
el
|
|
10143
10181
|
);
|
|
10144
10182
|
}
|
|
@@ -10697,7 +10735,7 @@ function isDirectChildOfTemplateFor (node) {
|
|
|
10697
10735
|
|
|
10698
10736
|
/* */
|
|
10699
10737
|
|
|
10700
|
-
const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
|
|
10738
|
+
const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
|
|
10701
10739
|
const fnInvokeRE = /\([^)]*?\);*$/;
|
|
10702
10740
|
const simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
|
10703
10741
|
|
|
@@ -11522,6 +11560,8 @@ function checkNode (node, warn) {
|
|
|
11522
11560
|
const range = node.rawAttrsMap[name];
|
|
11523
11561
|
if (name === 'v-for') {
|
|
11524
11562
|
checkFor(node, `v-for="${value}"`, warn, range);
|
|
11563
|
+
} else if (name === 'v-slot' || name[0] === '#') {
|
|
11564
|
+
checkFunctionParameterExpression(value, `${name}="${value}"`, warn, range);
|
|
11525
11565
|
} else if (onRE.test(name)) {
|
|
11526
11566
|
checkEvent(value, `${name}="${value}"`, warn, range);
|
|
11527
11567
|
} else {
|
|
@@ -11541,9 +11581,9 @@ function checkNode (node, warn) {
|
|
|
11541
11581
|
}
|
|
11542
11582
|
|
|
11543
11583
|
function checkEvent (exp, text, warn, range) {
|
|
11544
|
-
const
|
|
11545
|
-
const keywordMatch =
|
|
11546
|
-
if (keywordMatch &&
|
|
11584
|
+
const stripped = exp.replace(stripStringRE, '');
|
|
11585
|
+
const keywordMatch = stripped.match(unaryOperatorsRE);
|
|
11586
|
+
if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
|
|
11547
11587
|
warn(
|
|
11548
11588
|
`avoid using JavaScript unary operator as property name: ` +
|
|
11549
11589
|
`"${keywordMatch[0]}" in expression ${text.trim()}`,
|
|
@@ -11598,6 +11638,19 @@ function checkExpression (exp, text, warn, range) {
|
|
|
11598
11638
|
}
|
|
11599
11639
|
}
|
|
11600
11640
|
|
|
11641
|
+
function checkFunctionParameterExpression (exp, text, warn, range) {
|
|
11642
|
+
try {
|
|
11643
|
+
new Function(exp, '');
|
|
11644
|
+
} catch (e) {
|
|
11645
|
+
warn(
|
|
11646
|
+
`invalid function parameter expression: ${e.message} in\n\n` +
|
|
11647
|
+
` ${exp}\n\n` +
|
|
11648
|
+
` Raw expression: ${text.trim()}\n`,
|
|
11649
|
+
range
|
|
11650
|
+
);
|
|
11651
|
+
}
|
|
11652
|
+
}
|
|
11653
|
+
|
|
11601
11654
|
/* */
|
|
11602
11655
|
|
|
11603
11656
|
const range = 2;
|