@lwc/engine-core 2.45.0 → 2.45.2
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/dist/engine-core.cjs.js +142 -76
- package/dist/engine-core.cjs.js.map +1 -1
- package/dist/engine-core.js +143 -77
- package/dist/engine-core.js.map +1 -1
- package/package.json +4 -4
- package/types/framework/restrictions.d.ts +0 -1
package/dist/engine-core.cjs.js
CHANGED
|
@@ -530,8 +530,9 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
530
530
|
get() {
|
|
531
531
|
return originalOuterHTMLDescriptor.get.call(this);
|
|
532
532
|
},
|
|
533
|
-
set(
|
|
534
|
-
|
|
533
|
+
set(value) {
|
|
534
|
+
logError(`Invalid attempt to set outerHTML on Element.`);
|
|
535
|
+
return originalOuterHTMLDescriptor.set.call(this, value);
|
|
535
536
|
},
|
|
536
537
|
}),
|
|
537
538
|
};
|
|
@@ -616,16 +617,18 @@ function getShadowRootRestrictionsDescriptors(sr) {
|
|
|
616
617
|
get() {
|
|
617
618
|
return originalInnerHTMLDescriptor.get.call(this);
|
|
618
619
|
},
|
|
619
|
-
set(
|
|
620
|
-
|
|
620
|
+
set(value) {
|
|
621
|
+
logError(`Invalid attempt to set innerHTML on ShadowRoot.`);
|
|
622
|
+
return originalInnerHTMLDescriptor.set.call(this, value);
|
|
621
623
|
},
|
|
622
624
|
}),
|
|
623
625
|
textContent: generateAccessorDescriptor({
|
|
624
626
|
get() {
|
|
625
627
|
return originalTextContentDescriptor.get.call(this);
|
|
626
628
|
},
|
|
627
|
-
set(
|
|
628
|
-
|
|
629
|
+
set(value) {
|
|
630
|
+
logError(`Invalid attempt to set textContent on ShadowRoot.`);
|
|
631
|
+
return originalTextContentDescriptor.set.call(this, value);
|
|
629
632
|
},
|
|
630
633
|
}),
|
|
631
634
|
addEventListener: generateDataDescriptor({
|
|
@@ -654,24 +657,27 @@ function getCustomElementRestrictionsDescriptors(elm) {
|
|
|
654
657
|
get() {
|
|
655
658
|
return originalInnerHTMLDescriptor.get.call(this);
|
|
656
659
|
},
|
|
657
|
-
set(
|
|
658
|
-
|
|
660
|
+
set(value) {
|
|
661
|
+
logError(`Invalid attempt to set innerHTML on HTMLElement.`);
|
|
662
|
+
return originalInnerHTMLDescriptor.set.call(this, value);
|
|
659
663
|
},
|
|
660
664
|
}),
|
|
661
665
|
outerHTML: generateAccessorDescriptor({
|
|
662
666
|
get() {
|
|
663
667
|
return originalOuterHTMLDescriptor.get.call(this);
|
|
664
668
|
},
|
|
665
|
-
set(
|
|
666
|
-
|
|
669
|
+
set(value) {
|
|
670
|
+
logError(`Invalid attempt to set outerHTML on HTMLElement.`);
|
|
671
|
+
return originalOuterHTMLDescriptor.set.call(this, value);
|
|
667
672
|
},
|
|
668
673
|
}),
|
|
669
674
|
textContent: generateAccessorDescriptor({
|
|
670
675
|
get() {
|
|
671
676
|
return originalTextContentDescriptor.get.call(this);
|
|
672
677
|
},
|
|
673
|
-
set(
|
|
674
|
-
|
|
678
|
+
set(value) {
|
|
679
|
+
logError(`Invalid attempt to set textContent on HTMLElement.`);
|
|
680
|
+
return originalTextContentDescriptor.set.call(this, value);
|
|
675
681
|
},
|
|
676
682
|
}),
|
|
677
683
|
addEventListener: generateDataDescriptor({
|
|
@@ -687,20 +693,6 @@ function getCustomElementRestrictionsDescriptors(elm) {
|
|
|
687
693
|
}),
|
|
688
694
|
};
|
|
689
695
|
}
|
|
690
|
-
function getComponentRestrictionsDescriptors() {
|
|
691
|
-
assertNotProd(); // this method should never leak to prod
|
|
692
|
-
return {
|
|
693
|
-
tagName: generateAccessorDescriptor({
|
|
694
|
-
get() {
|
|
695
|
-
throw new Error(`Usage of property \`tagName\` is disallowed because the component itself does` +
|
|
696
|
-
` not know which tagName will be used to create the element, therefore writing` +
|
|
697
|
-
` code that check for that value is error prone.`);
|
|
698
|
-
},
|
|
699
|
-
configurable: true,
|
|
700
|
-
enumerable: false, // no enumerable properties on component
|
|
701
|
-
}),
|
|
702
|
-
};
|
|
703
|
-
}
|
|
704
696
|
function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
|
705
697
|
assertNotProd(); // this method should never leak to prod
|
|
706
698
|
const originalDispatchEvent = proto.dispatchEvent;
|
|
@@ -733,9 +725,6 @@ function patchCustomElementWithRestrictions(elm) {
|
|
|
733
725
|
const elmProto = shared.getPrototypeOf(elm);
|
|
734
726
|
shared.setPrototypeOf(elm, shared.create(elmProto, restrictionsDescriptors));
|
|
735
727
|
}
|
|
736
|
-
function patchComponentWithRestrictions(cmp) {
|
|
737
|
-
shared.defineProperties(cmp, getComponentRestrictionsDescriptors());
|
|
738
|
-
}
|
|
739
728
|
function patchLightningElementPrototypeWithRestrictions(proto) {
|
|
740
729
|
shared.defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
|
|
741
730
|
}
|
|
@@ -1346,16 +1335,10 @@ function markLockerLiveObject(obj) {
|
|
|
1346
1335
|
function createBridgeToElementDescriptor(propName, descriptor) {
|
|
1347
1336
|
const { get, set, enumerable, configurable } = descriptor;
|
|
1348
1337
|
if (!shared.isFunction(get)) {
|
|
1349
|
-
|
|
1350
|
-
shared.assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard getter.`);
|
|
1351
|
-
}
|
|
1352
|
-
throw new TypeError();
|
|
1338
|
+
throw new TypeError(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard getter.`);
|
|
1353
1339
|
}
|
|
1354
1340
|
if (!shared.isFunction(set)) {
|
|
1355
|
-
|
|
1356
|
-
shared.assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard setter.`);
|
|
1357
|
-
}
|
|
1358
|
-
throw new TypeError();
|
|
1341
|
+
throw new TypeError(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard setter.`);
|
|
1359
1342
|
}
|
|
1360
1343
|
return {
|
|
1361
1344
|
enumerable,
|
|
@@ -1375,10 +1358,18 @@ function createBridgeToElementDescriptor(propName, descriptor) {
|
|
|
1375
1358
|
const vm = getAssociatedVM(this);
|
|
1376
1359
|
if (process.env.NODE_ENV !== 'production') {
|
|
1377
1360
|
const vmBeingRendered = getVMBeingRendered();
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1361
|
+
if (isInvokingRender) {
|
|
1362
|
+
logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm}.${propName}`);
|
|
1363
|
+
}
|
|
1364
|
+
if (isUpdatingTemplate) {
|
|
1365
|
+
logError(`When updating the template of ${vmBeingRendered}, one of the accessors used by the template has side effects on the state of ${vm}.${propName}`);
|
|
1366
|
+
}
|
|
1367
|
+
if (isBeingConstructed(vm)) {
|
|
1368
|
+
logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
1369
|
+
}
|
|
1370
|
+
if (shared.isObject(newValue) && !shared.isNull(newValue)) {
|
|
1371
|
+
logError(`Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
|
|
1372
|
+
}
|
|
1382
1373
|
}
|
|
1383
1374
|
updateComponentValue(vm, propName, newValue);
|
|
1384
1375
|
return set.call(vm.elm, newValue);
|
|
@@ -1431,7 +1422,6 @@ const LightningElement = function () {
|
|
|
1431
1422
|
// Adding extra guard rails in DEV mode.
|
|
1432
1423
|
if (process.env.NODE_ENV !== 'production') {
|
|
1433
1424
|
patchCustomElementWithRestrictions(elm);
|
|
1434
|
-
patchComponentWithRestrictions(component);
|
|
1435
1425
|
}
|
|
1436
1426
|
return this;
|
|
1437
1427
|
};
|
|
@@ -1467,9 +1457,15 @@ LightningElement.prototype = {
|
|
|
1467
1457
|
const { elm, renderer: { addEventListener }, } = vm;
|
|
1468
1458
|
if (process.env.NODE_ENV !== 'production') {
|
|
1469
1459
|
const vmBeingRendered = getVMBeingRendered();
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1460
|
+
if (isInvokingRender) {
|
|
1461
|
+
logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
1462
|
+
}
|
|
1463
|
+
if (isUpdatingTemplate) {
|
|
1464
|
+
logError(`Updating the template of ${vmBeingRendered} has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
1465
|
+
}
|
|
1466
|
+
if (!shared.isFunction(listener)) {
|
|
1467
|
+
logError(`Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
|
|
1468
|
+
}
|
|
1473
1469
|
}
|
|
1474
1470
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
1475
1471
|
addEventListener(elm, type, wrappedListener, options);
|
|
@@ -1519,7 +1515,9 @@ LightningElement.prototype = {
|
|
|
1519
1515
|
const vm = getAssociatedVM(this);
|
|
1520
1516
|
const { elm, renderer: { setAttribute }, } = vm;
|
|
1521
1517
|
if (process.env.NODE_ENV !== 'production') {
|
|
1522
|
-
|
|
1518
|
+
if (isBeingConstructed(vm)) {
|
|
1519
|
+
logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
1520
|
+
}
|
|
1523
1521
|
}
|
|
1524
1522
|
unlockAttribute(elm, name);
|
|
1525
1523
|
setAttribute(elm, name, value);
|
|
@@ -1529,7 +1527,9 @@ LightningElement.prototype = {
|
|
|
1529
1527
|
const vm = getAssociatedVM(this);
|
|
1530
1528
|
const { elm, renderer: { setAttribute }, } = vm;
|
|
1531
1529
|
if (process.env.NODE_ENV !== 'production') {
|
|
1532
|
-
|
|
1530
|
+
if (isBeingConstructed(vm)) {
|
|
1531
|
+
logError(`Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
1532
|
+
}
|
|
1533
1533
|
}
|
|
1534
1534
|
unlockAttribute(elm, name);
|
|
1535
1535
|
setAttribute(elm, name, value, namespace);
|
|
@@ -1552,9 +1552,9 @@ LightningElement.prototype = {
|
|
|
1552
1552
|
const vm = getAssociatedVM(this);
|
|
1553
1553
|
const { elm, renderer: { getClassList }, } = vm;
|
|
1554
1554
|
if (process.env.NODE_ENV !== 'production') {
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1555
|
+
if (isBeingConstructed(vm)) {
|
|
1556
|
+
logError(`Failed to construct ${vm}: The result must not have attributes. Adding or tampering with classname in constructor is not allowed in a web component, use connectedCallback() instead.`);
|
|
1557
|
+
}
|
|
1558
1558
|
}
|
|
1559
1559
|
return getClassList(elm);
|
|
1560
1560
|
},
|
|
@@ -2060,8 +2060,12 @@ function createPublicPropertyDescriptor(key) {
|
|
|
2060
2060
|
const vm = getAssociatedVM(this);
|
|
2061
2061
|
if (process.env.NODE_ENV !== 'production') {
|
|
2062
2062
|
const vmBeingRendered = getVMBeingRendered();
|
|
2063
|
-
|
|
2064
|
-
|
|
2063
|
+
if (isInvokingRender) {
|
|
2064
|
+
logError(`render() method has side effects on the state of property "${shared.toString(key)}"`, shared.isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2065
|
+
}
|
|
2066
|
+
if (isUpdatingTemplate) {
|
|
2067
|
+
logError(`Updating the template has side effects on the state of property "${shared.toString(key)}"`, shared.isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2068
|
+
}
|
|
2065
2069
|
}
|
|
2066
2070
|
vm.cmpProps[key] = newValue;
|
|
2067
2071
|
componentValueMutated(vm, key);
|
|
@@ -2085,14 +2089,18 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
2085
2089
|
const vm = getAssociatedVM(this);
|
|
2086
2090
|
if (process.env.NODE_ENV !== 'production') {
|
|
2087
2091
|
const vmBeingRendered = getVMBeingRendered();
|
|
2088
|
-
|
|
2089
|
-
|
|
2092
|
+
if (isInvokingRender) {
|
|
2093
|
+
logError(`render() method has side effects on the state of property "${shared.toString(key)}"`, shared.isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2094
|
+
}
|
|
2095
|
+
if (isUpdatingTemplate) {
|
|
2096
|
+
logError(`Updating the template has side effects on the state of property "${shared.toString(key)}"`, shared.isNull(vmBeingRendered) ? vm : vmBeingRendered);
|
|
2097
|
+
}
|
|
2090
2098
|
}
|
|
2091
2099
|
if (set) {
|
|
2092
2100
|
set.call(this, newValue);
|
|
2093
2101
|
}
|
|
2094
2102
|
else if (process.env.NODE_ENV !== 'production') {
|
|
2095
|
-
|
|
2103
|
+
logError(`Invalid attempt to set a new value for property "${shared.toString(key)}" that does not has a setter decorated with @api.`, vm);
|
|
2096
2104
|
}
|
|
2097
2105
|
},
|
|
2098
2106
|
enumerable,
|
|
@@ -2126,8 +2134,12 @@ function internalTrackDecorator(key) {
|
|
|
2126
2134
|
const vm = getAssociatedVM(this);
|
|
2127
2135
|
if (process.env.NODE_ENV !== 'production') {
|
|
2128
2136
|
const vmBeingRendered = getVMBeingRendered();
|
|
2129
|
-
|
|
2130
|
-
|
|
2137
|
+
if (isInvokingRender) {
|
|
2138
|
+
logError(`${vmBeingRendered}.render() method has side effects on the state of ${vm}.${shared.toString(key)}`);
|
|
2139
|
+
}
|
|
2140
|
+
if (isUpdatingTemplate) {
|
|
2141
|
+
logError(`Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${shared.toString(key)}`);
|
|
2142
|
+
}
|
|
2131
2143
|
}
|
|
2132
2144
|
const reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
2133
2145
|
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
@@ -2904,13 +2916,20 @@ function createComponentDef(Ctor) {
|
|
|
2904
2916
|
const ctorName = Ctor.name;
|
|
2905
2917
|
// Removing the following assert until https://bugs.webkit.org/show_bug.cgi?id=190140 is fixed.
|
|
2906
2918
|
// assert.isTrue(ctorName && isString(ctorName), `${toString(Ctor)} should have a "name" property with string value, but found ${ctorName}.`);
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2919
|
+
if (!Ctor.constructor) {
|
|
2920
|
+
// This error seems impossible to hit, due to an earlier check in `isComponentConstructor()`.
|
|
2921
|
+
// But we keep it here just in case.
|
|
2922
|
+
logError(`Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
|
|
2911
2923
|
}
|
|
2912
|
-
if (!shared.isUndefined(
|
|
2913
|
-
|
|
2924
|
+
if (!shared.isUndefined(ctorShadowSupportMode) &&
|
|
2925
|
+
ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ &&
|
|
2926
|
+
ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */) {
|
|
2927
|
+
logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
|
2928
|
+
}
|
|
2929
|
+
if (!shared.isUndefined(ctorRenderMode) &&
|
|
2930
|
+
ctorRenderMode !== 'light' &&
|
|
2931
|
+
ctorRenderMode !== 'shadow') {
|
|
2932
|
+
logError(`Invalid value for static property renderMode: '${ctorRenderMode}'. renderMode must be either 'light' or 'shadow'.`);
|
|
2914
2933
|
}
|
|
2915
2934
|
}
|
|
2916
2935
|
const decoratorsMeta = getDecoratorsMeta(Ctor);
|
|
@@ -4692,7 +4711,7 @@ function k(compilerKey, obj) {
|
|
|
4692
4711
|
return compilerKey + ':' + obj;
|
|
4693
4712
|
case 'object':
|
|
4694
4713
|
if (process.env.NODE_ENV !== 'production') {
|
|
4695
|
-
|
|
4714
|
+
logError(`Invalid key value "${obj}" in ${getVMBeingRendered()}. Key must be a string or number.`);
|
|
4696
4715
|
}
|
|
4697
4716
|
}
|
|
4698
4717
|
}
|
|
@@ -4982,13 +5001,19 @@ function validateSlots(vm) {
|
|
|
4982
5001
|
}
|
|
4983
5002
|
}
|
|
4984
5003
|
function validateLightDomTemplate(template, vm) {
|
|
4985
|
-
|
|
5004
|
+
assertNotProd(); // should never leak to prod mode
|
|
5005
|
+
if (template === defaultEmptyTemplate) {
|
|
4986
5006
|
return;
|
|
5007
|
+
}
|
|
4987
5008
|
if (vm.renderMode === 0 /* RenderMode.Light */) {
|
|
4988
|
-
|
|
5009
|
+
if (template.renderMode !== 'light') {
|
|
5010
|
+
logError(`Light DOM components can't render shadow DOM templates. Add an 'lwc:render-mode="light"' directive to the root template tag of ${getComponentTag(vm)}.`);
|
|
5011
|
+
}
|
|
4989
5012
|
}
|
|
4990
5013
|
else {
|
|
4991
|
-
|
|
5014
|
+
if (!shared.isUndefined(template.renderMode)) {
|
|
5015
|
+
logError(`Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${getComponentTag(vm)} or set it to 'lwc:render-mode="shadow"`);
|
|
5016
|
+
}
|
|
4992
5017
|
}
|
|
4993
5018
|
}
|
|
4994
5019
|
function buildParseFragmentFn(createFragmentFn) {
|
|
@@ -5121,7 +5146,9 @@ function evaluateTemplate(vm, html) {
|
|
|
5121
5146
|
logOperationEnd(1 /* OperationId.Render */, vm);
|
|
5122
5147
|
});
|
|
5123
5148
|
if (process.env.NODE_ENV !== 'production') {
|
|
5124
|
-
|
|
5149
|
+
if (!shared.isArray(vnodes)) {
|
|
5150
|
+
logError(`Compiler should produce html functions that always return an array.`);
|
|
5151
|
+
}
|
|
5125
5152
|
}
|
|
5126
5153
|
return vnodes;
|
|
5127
5154
|
}
|
|
@@ -6213,6 +6240,27 @@ function textNodeContentsAreEqual(node, vnode, renderer) {
|
|
|
6213
6240
|
}
|
|
6214
6241
|
return false;
|
|
6215
6242
|
}
|
|
6243
|
+
// The validationOptOut static property can be an array of attribute names.
|
|
6244
|
+
// Any attribute names specified in that array will not be validated, and the
|
|
6245
|
+
// LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
|
|
6246
|
+
function getValidationPredicate(optOutStaticProp) {
|
|
6247
|
+
if (shared.isUndefined(optOutStaticProp)) {
|
|
6248
|
+
return (_attrName) => true;
|
|
6249
|
+
}
|
|
6250
|
+
// If validationOptOut is true, no attributes will be checked for correctness
|
|
6251
|
+
// and the runtime will assume VDOM attrs and DOM attrs are in sync.
|
|
6252
|
+
if (shared.isTrue(optOutStaticProp)) {
|
|
6253
|
+
return (_attrName) => false;
|
|
6254
|
+
}
|
|
6255
|
+
// If validationOptOut is an array of strings, attributes specified in the
|
|
6256
|
+
// array will be "opted out". Attributes not specified in the array will still
|
|
6257
|
+
// be validated.
|
|
6258
|
+
if (shared.isArray(optOutStaticProp) && shared.arrayEvery(optOutStaticProp, shared.isString)) {
|
|
6259
|
+
return (attrName) => !shared.ArrayIncludes.call(optOutStaticProp, attrName);
|
|
6260
|
+
}
|
|
6261
|
+
logWarn('Validation opt out must be `true` or an array of attributes that should not be validated.');
|
|
6262
|
+
return (_attrName) => true;
|
|
6263
|
+
}
|
|
6216
6264
|
function hydrateText(node, vnode, renderer) {
|
|
6217
6265
|
var _a;
|
|
6218
6266
|
if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
|
@@ -6291,8 +6339,19 @@ function hydrateElement(elm, vnode, renderer) {
|
|
|
6291
6339
|
return elm;
|
|
6292
6340
|
}
|
|
6293
6341
|
function hydrateCustomElement(elm, vnode, renderer) {
|
|
6342
|
+
const { validationOptOut } = vnode.ctor;
|
|
6343
|
+
const shouldValidateAttr = getValidationPredicate(validationOptOut);
|
|
6344
|
+
// The validationOptOut static property can be an array of attribute names.
|
|
6345
|
+
// Any attribute names specified in that array will not be validated, and the
|
|
6346
|
+
// LWC runtime will assume that VDOM attrs and DOM attrs are in sync.
|
|
6347
|
+
//
|
|
6348
|
+
// If validationOptOut is true, no attributes will be checked for correctness
|
|
6349
|
+
// and the runtime will assume VDOM attrs and DOM attrs are in sync.
|
|
6350
|
+
//
|
|
6351
|
+
// Therefore, if validationOptOut is falsey or an array of strings, we need to
|
|
6352
|
+
// examine some or all of the custom element's attributes.
|
|
6294
6353
|
if (!hasCorrectNodeType(vnode, elm, 1 /* EnvNodeTypes.ELEMENT */, renderer) ||
|
|
6295
|
-
!isMatchingElement(vnode, elm, renderer)) {
|
|
6354
|
+
!isMatchingElement(vnode, elm, renderer, shouldValidateAttr)) {
|
|
6296
6355
|
return handleMismatch(elm, vnode, renderer);
|
|
6297
6356
|
}
|
|
6298
6357
|
const { sel, mode, ctor, owner } = vnode;
|
|
@@ -6386,7 +6445,7 @@ function hasCorrectNodeType(vnode, node, nodeType, renderer) {
|
|
|
6386
6445
|
}
|
|
6387
6446
|
return true;
|
|
6388
6447
|
}
|
|
6389
|
-
function isMatchingElement(vnode, elm, renderer) {
|
|
6448
|
+
function isMatchingElement(vnode, elm, renderer, shouldValidateAttr = () => true) {
|
|
6390
6449
|
const { getProperty } = renderer;
|
|
6391
6450
|
if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
|
|
6392
6451
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -6394,10 +6453,14 @@ function isMatchingElement(vnode, elm, renderer) {
|
|
|
6394
6453
|
}
|
|
6395
6454
|
return false;
|
|
6396
6455
|
}
|
|
6397
|
-
const
|
|
6398
|
-
const
|
|
6399
|
-
|
|
6400
|
-
|
|
6456
|
+
const hasCompatibleAttrs = validateAttrs(vnode, elm, renderer, shouldValidateAttr);
|
|
6457
|
+
const hasCompatibleClass = shouldValidateAttr('class')
|
|
6458
|
+
? validateClassAttr(vnode, elm, renderer)
|
|
6459
|
+
: true;
|
|
6460
|
+
const hasCompatibleStyle = shouldValidateAttr('style')
|
|
6461
|
+
? validateStyleAttr(vnode, elm, renderer)
|
|
6462
|
+
: true;
|
|
6463
|
+
return hasCompatibleAttrs && hasCompatibleClass && hasCompatibleStyle;
|
|
6401
6464
|
}
|
|
6402
6465
|
function attributeValuesAreEqual(vnodeValue, value) {
|
|
6403
6466
|
const vnodeValueAsString = String(vnodeValue);
|
|
@@ -6412,12 +6475,15 @@ function attributeValuesAreEqual(vnodeValue, value) {
|
|
|
6412
6475
|
// In all other cases, the two values are not considered equal
|
|
6413
6476
|
return false;
|
|
6414
6477
|
}
|
|
6415
|
-
function validateAttrs(vnode, elm, renderer) {
|
|
6478
|
+
function validateAttrs(vnode, elm, renderer, shouldValidateAttr) {
|
|
6416
6479
|
const { data: { attrs = {} }, } = vnode;
|
|
6417
6480
|
let nodesAreCompatible = true;
|
|
6418
6481
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6419
6482
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6420
6483
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6484
|
+
if (!shouldValidateAttr(attrName)) {
|
|
6485
|
+
continue;
|
|
6486
|
+
}
|
|
6421
6487
|
const { owner } = vnode;
|
|
6422
6488
|
const { getAttribute } = renderer;
|
|
6423
6489
|
const elmAttrValue = getAttribute(elm, attrName);
|
|
@@ -6880,5 +6946,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
6880
6946
|
exports.track = track;
|
|
6881
6947
|
exports.unwrap = unwrap;
|
|
6882
6948
|
exports.wire = wire;
|
|
6883
|
-
/* version: 2.45.
|
|
6949
|
+
/* version: 2.45.2 */
|
|
6884
6950
|
//# sourceMappingURL=engine-core.cjs.js.map
|