lwc 2.29.0 → 2.30.0
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-dom/esm/es2017/engine-dom.js +319 -683
- package/dist/engine-dom/iife/es2017/engine-dom.js +319 -683
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +201 -624
- package/dist/engine-dom/iife/es5/engine-dom.js +1138 -2843
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +892 -2428
- package/dist/engine-dom/umd/es2017/engine-dom.js +319 -683
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +201 -624
- package/dist/engine-dom/umd/es5/engine-dom.js +1138 -2843
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +892 -2428
- package/dist/engine-server/commonjs/es2017/engine-server.js +204 -584
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +204 -584
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +99 -323
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +99 -323
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +98 -316
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +483 -1220
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +470 -1187
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +99 -323
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +98 -316
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +483 -1220
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +470 -1187
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +13 -68
- package/dist/wire-service/iife/es5/wire-service_debug.js +13 -68
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +13 -68
- package/dist/wire-service/umd/es5/wire-service_debug.js +13 -68
- package/package.json +7 -7
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
// We use this to detect symbol support in order to avoid the expensive symbol polyfill. Note that
|
|
152
152
|
// we can't use typeof since it will fail when transpiling.
|
|
153
153
|
const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === 'Symbol(x)')();
|
|
154
|
-
/** version: 2.
|
|
154
|
+
/** version: 2.30.0 */
|
|
155
155
|
|
|
156
156
|
/*
|
|
157
157
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -465,7 +465,7 @@
|
|
|
465
465
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
466
466
|
}
|
|
467
467
|
const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
|
|
468
|
-
/** version: 2.
|
|
468
|
+
/** version: 2.30.0 */
|
|
469
469
|
|
|
470
470
|
/*
|
|
471
471
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -473,25 +473,22 @@
|
|
|
473
473
|
* SPDX-License-Identifier: MIT
|
|
474
474
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
475
475
|
*/
|
|
476
|
-
|
|
476
|
+
// Used as a back reference to identify the host element
|
|
477
477
|
const HostElementKey = '$$HostElementKey$$';
|
|
478
478
|
const ShadowedNodeKey = '$$ShadowedNodeKey$$';
|
|
479
|
-
|
|
480
479
|
function fastDefineProperty(node, propName, config) {
|
|
481
480
|
const shadowedNode = node;
|
|
482
|
-
|
|
483
481
|
if (process.env.NODE_ENV !== 'production') {
|
|
484
482
|
// in dev, we are more restrictive
|
|
485
483
|
defineProperty(shadowedNode, propName, config);
|
|
486
484
|
} else {
|
|
487
485
|
const {
|
|
488
486
|
value
|
|
489
|
-
} = config;
|
|
490
|
-
|
|
487
|
+
} = config;
|
|
488
|
+
// in prod, we prioritize performance
|
|
491
489
|
shadowedNode[propName] = value;
|
|
492
490
|
}
|
|
493
491
|
}
|
|
494
|
-
|
|
495
492
|
function setNodeOwnerKey(node, value) {
|
|
496
493
|
fastDefineProperty(node, HostElementKey, {
|
|
497
494
|
value,
|
|
@@ -508,18 +505,15 @@
|
|
|
508
505
|
}
|
|
509
506
|
function getNodeNearestOwnerKey(node) {
|
|
510
507
|
let host = node;
|
|
511
|
-
let hostKey;
|
|
508
|
+
let hostKey;
|
|
509
|
+
// search for the first element with owner identity
|
|
512
510
|
// in case of manually inserted elements and elements slotted from Light DOM
|
|
513
|
-
|
|
514
511
|
while (!isNull(host)) {
|
|
515
512
|
hostKey = getNodeOwnerKey(host);
|
|
516
|
-
|
|
517
513
|
if (!isUndefined(hostKey)) {
|
|
518
514
|
return hostKey;
|
|
519
515
|
}
|
|
520
|
-
|
|
521
516
|
host = parentNodeGetter.call(host);
|
|
522
|
-
|
|
523
517
|
if (lwcRuntimeFlags.ENABLE_LIGHT_GET_ROOT_NODE_PATCH) {
|
|
524
518
|
if (!isNull(host) && isSyntheticSlotElement(host)) {
|
|
525
519
|
return undefined;
|
|
@@ -535,7 +529,6 @@
|
|
|
535
529
|
* cases. If we need to traverse up and verify those nodes that don't have owner key, use
|
|
536
530
|
* isNodeDeepShadowed instead.
|
|
537
531
|
*/
|
|
538
|
-
|
|
539
532
|
function isNodeShadowed(node) {
|
|
540
533
|
return !isUndefined(getNodeOwnerKey(node));
|
|
541
534
|
}
|
|
@@ -546,35 +539,29 @@
|
|
|
546
539
|
* SPDX-License-Identifier: MIT
|
|
547
540
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
548
541
|
*/
|
|
542
|
+
// when finding a slot in the DOM, we can fold it if it is contained
|
|
549
543
|
// inside another slot.
|
|
550
|
-
|
|
551
544
|
function foldSlotElement(slot) {
|
|
552
545
|
let parent = parentElementGetter.call(slot);
|
|
553
|
-
|
|
554
546
|
while (!isNull(parent) && isSlotElement(parent)) {
|
|
555
547
|
slot = parent;
|
|
556
548
|
parent = parentElementGetter.call(slot);
|
|
557
549
|
}
|
|
558
|
-
|
|
559
550
|
return slot;
|
|
560
551
|
}
|
|
561
|
-
|
|
562
552
|
function isNodeSlotted(host, node) {
|
|
563
553
|
if (process.env.NODE_ENV !== 'production') {
|
|
564
554
|
assert.invariant(host instanceof HTMLElement, `isNodeSlotted() should be called with a host as the first argument instead of ${host}`);
|
|
565
555
|
assert.invariant(node instanceof _Node, `isNodeSlotted() should be called with a node as the second argument instead of ${node}`);
|
|
566
556
|
assert.invariant(compareDocumentPosition.call(node, host) & DOCUMENT_POSITION_CONTAINS, `isNodeSlotted() should never be called with a node that is not a child node of ${host}`);
|
|
567
557
|
}
|
|
568
|
-
|
|
569
|
-
|
|
558
|
+
const hostKey = getNodeKey(host);
|
|
559
|
+
// this routine assumes that the node is coming from a different shadow (it is not owned by the host)
|
|
570
560
|
// just in case the provided node is not an element
|
|
571
|
-
|
|
572
561
|
let currentElement = node instanceof Element ? node : parentElementGetter.call(node);
|
|
573
|
-
|
|
574
562
|
while (!isNull(currentElement) && currentElement !== host) {
|
|
575
563
|
const elmOwnerKey = getNodeNearestOwnerKey(currentElement);
|
|
576
564
|
const parent = parentElementGetter.call(currentElement);
|
|
577
|
-
|
|
578
565
|
if (elmOwnerKey === hostKey) {
|
|
579
566
|
// we have reached an element inside the host's template, and only if
|
|
580
567
|
// that element is an slot, then the node is considered slotted
|
|
@@ -600,7 +587,6 @@
|
|
|
600
587
|
* most outer slot parent before jumping into its corresponding host.
|
|
601
588
|
*/
|
|
602
589
|
currentElement = getNodeOwner(foldSlotElement(parent));
|
|
603
|
-
|
|
604
590
|
if (!isNull(currentElement)) {
|
|
605
591
|
if (currentElement === host) {
|
|
606
592
|
// the slot element is a top level element inside the shadow
|
|
@@ -619,32 +605,25 @@
|
|
|
619
605
|
currentElement = parent;
|
|
620
606
|
}
|
|
621
607
|
}
|
|
622
|
-
|
|
623
608
|
return false;
|
|
624
609
|
}
|
|
625
|
-
|
|
626
610
|
function getNodeOwner(node) {
|
|
627
611
|
if (!(node instanceof _Node)) {
|
|
628
612
|
return null;
|
|
629
613
|
}
|
|
630
|
-
|
|
631
614
|
const ownerKey = getNodeNearestOwnerKey(node);
|
|
632
|
-
|
|
633
615
|
if (isUndefined(ownerKey)) {
|
|
634
616
|
return null;
|
|
635
617
|
}
|
|
636
|
-
|
|
637
|
-
|
|
618
|
+
let nodeOwner = node;
|
|
619
|
+
// At this point, node is a valid node with owner identity, now we need to find the owner node
|
|
638
620
|
// search for a custom element with a VM that owns the first element with owner identity attached to it
|
|
639
|
-
|
|
640
621
|
while (!isNull(nodeOwner) && getNodeKey(nodeOwner) !== ownerKey) {
|
|
641
622
|
nodeOwner = parentNodeGetter.call(nodeOwner);
|
|
642
623
|
}
|
|
643
|
-
|
|
644
624
|
if (isNull(nodeOwner)) {
|
|
645
625
|
return null;
|
|
646
626
|
}
|
|
647
|
-
|
|
648
627
|
return nodeOwner;
|
|
649
628
|
}
|
|
650
629
|
function isSyntheticSlotElement(node) {
|
|
@@ -659,23 +638,18 @@
|
|
|
659
638
|
assert.invariant(node instanceof _Node, `isNodeOwnedBy() should be called with a node as the second argument instead of ${node}`);
|
|
660
639
|
assert.invariant(compareDocumentPosition.call(node, owner) & DOCUMENT_POSITION_CONTAINS, `isNodeOwnedBy() should never be called with a node that is not a child node of ${owner}`);
|
|
661
640
|
}
|
|
662
|
-
|
|
663
641
|
const ownerKey = getNodeNearestOwnerKey(node);
|
|
664
|
-
|
|
665
642
|
if (isUndefined(ownerKey)) {
|
|
666
643
|
if (lwcRuntimeFlags.ENABLE_LIGHT_GET_ROOT_NODE_PATCH) {
|
|
667
644
|
// in case of root level light DOM element slotting into a synthetic shadow
|
|
668
645
|
const host = parentNodeGetter.call(node);
|
|
669
|
-
|
|
670
646
|
if (!isNull(host) && isSyntheticSlotElement(host)) {
|
|
671
647
|
return false;
|
|
672
648
|
}
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
|
|
649
|
+
}
|
|
650
|
+
// in case of manually inserted elements
|
|
676
651
|
return true;
|
|
677
652
|
}
|
|
678
|
-
|
|
679
653
|
return getNodeKey(owner) === ownerKey;
|
|
680
654
|
}
|
|
681
655
|
function shadowRootChildNodes(root) {
|
|
@@ -684,42 +658,34 @@
|
|
|
684
658
|
}
|
|
685
659
|
function getAllSlottedMatches(host, nodeList) {
|
|
686
660
|
const filteredAndPatched = [];
|
|
687
|
-
|
|
688
661
|
for (let i = 0, len = nodeList.length; i < len; i += 1) {
|
|
689
662
|
const node = nodeList[i];
|
|
690
|
-
|
|
691
663
|
if (!isNodeOwnedBy(host, node) && isNodeSlotted(host, node)) {
|
|
692
664
|
ArrayPush.call(filteredAndPatched, node);
|
|
693
665
|
}
|
|
694
666
|
}
|
|
695
|
-
|
|
696
667
|
return filteredAndPatched;
|
|
697
668
|
}
|
|
698
669
|
function getFirstSlottedMatch(host, nodeList) {
|
|
699
670
|
for (let i = 0, len = nodeList.length; i < len; i += 1) {
|
|
700
671
|
const node = nodeList[i];
|
|
701
|
-
|
|
702
672
|
if (!isNodeOwnedBy(host, node) && isNodeSlotted(host, node)) {
|
|
703
673
|
return node;
|
|
704
674
|
}
|
|
705
675
|
}
|
|
706
|
-
|
|
707
676
|
return null;
|
|
708
677
|
}
|
|
709
678
|
function getAllMatches(owner, nodeList) {
|
|
710
679
|
const filteredAndPatched = [];
|
|
711
|
-
|
|
712
680
|
for (let i = 0, len = nodeList.length; i < len; i += 1) {
|
|
713
681
|
const node = nodeList[i];
|
|
714
682
|
const isOwned = isNodeOwnedBy(owner, node);
|
|
715
|
-
|
|
716
683
|
if (isOwned) {
|
|
717
684
|
// Patch querySelector, querySelectorAll, etc
|
|
718
685
|
// if element is owned by VM
|
|
719
686
|
ArrayPush.call(filteredAndPatched, node);
|
|
720
687
|
}
|
|
721
688
|
}
|
|
722
|
-
|
|
723
689
|
return filteredAndPatched;
|
|
724
690
|
}
|
|
725
691
|
function getFirstMatch(owner, nodeList) {
|
|
@@ -728,7 +694,6 @@
|
|
|
728
694
|
return nodeList[i];
|
|
729
695
|
}
|
|
730
696
|
}
|
|
731
|
-
|
|
732
697
|
return null;
|
|
733
698
|
}
|
|
734
699
|
function shadowRootQuerySelector(root, selector) {
|
|
@@ -747,19 +712,17 @@
|
|
|
747
712
|
const children = childNodesGetter.call(node);
|
|
748
713
|
return arrayFromCollection(children);
|
|
749
714
|
}
|
|
750
|
-
|
|
751
715
|
if (isSyntheticShadowHost(node)) {
|
|
752
716
|
// we need to get only the nodes that were slotted
|
|
753
717
|
const slots = arrayFromCollection(querySelectorAll$1.call(node, 'slot'));
|
|
754
|
-
const resolver = getShadowRootResolver(getShadowRoot(node));
|
|
718
|
+
const resolver = getShadowRootResolver(getShadowRoot(node));
|
|
719
|
+
// Typescript is inferring the wrong function type for this particular
|
|
755
720
|
// overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
|
|
756
721
|
// @ts-ignore type-mismatch
|
|
757
|
-
|
|
758
722
|
return ArrayReduce.call(slots, (seed, slot) => {
|
|
759
723
|
if (resolver === getShadowRootResolver(slot)) {
|
|
760
724
|
ArrayPush.apply(seed, getFilteredSlotAssignedNodes(slot));
|
|
761
725
|
}
|
|
762
|
-
|
|
763
726
|
return seed;
|
|
764
727
|
}, []);
|
|
765
728
|
} else {
|
|
@@ -771,11 +734,9 @@
|
|
|
771
734
|
}
|
|
772
735
|
function getFilteredSlotAssignedNodes(slot) {
|
|
773
736
|
const owner = getNodeOwner(slot);
|
|
774
|
-
|
|
775
737
|
if (isNull(owner)) {
|
|
776
738
|
return [];
|
|
777
739
|
}
|
|
778
|
-
|
|
779
740
|
const childNodes = arrayFromCollection(childNodesGetter.call(slot));
|
|
780
741
|
return ArrayFilter.call(childNodes, child => !isNodeShadowed(child) || !isNodeOwnedBy(owner, child));
|
|
781
742
|
}
|
|
@@ -1197,14 +1158,11 @@
|
|
|
1197
1158
|
* and elements with shadow dom attached to them. It doesn't apply to native slot elements
|
|
1198
1159
|
* because we don't want to patch the children getters for those elements.
|
|
1199
1160
|
*/
|
|
1200
|
-
|
|
1201
1161
|
function hasMountedChildren(node) {
|
|
1202
1162
|
return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
|
|
1203
1163
|
}
|
|
1204
|
-
|
|
1205
1164
|
function getShadowParent(node, value) {
|
|
1206
1165
|
const owner = getNodeOwner(node);
|
|
1207
|
-
|
|
1208
1166
|
if (value === owner) {
|
|
1209
1167
|
// walking up via parent chain might end up in the shadow root element
|
|
1210
1168
|
return getShadowRoot(owner);
|
|
@@ -1217,64 +1175,50 @@
|
|
|
1217
1175
|
// where they slotted into, but its shadowed parent is always the
|
|
1218
1176
|
// owner of the slot.
|
|
1219
1177
|
const slotOwner = getNodeOwner(value);
|
|
1220
|
-
|
|
1221
1178
|
if (!isNull(slotOwner) && isNodeOwnedBy(owner, slotOwner)) {
|
|
1222
1179
|
// it is a slotted element, and therefore its parent is always going to be the host of the slot
|
|
1223
1180
|
return slotOwner;
|
|
1224
1181
|
}
|
|
1225
1182
|
}
|
|
1226
1183
|
}
|
|
1227
|
-
|
|
1228
1184
|
return null;
|
|
1229
1185
|
}
|
|
1230
|
-
|
|
1231
1186
|
function hasChildNodesPatched() {
|
|
1232
1187
|
return getInternalChildNodes(this).length > 0;
|
|
1233
1188
|
}
|
|
1234
|
-
|
|
1235
1189
|
function firstChildGetterPatched() {
|
|
1236
1190
|
const childNodes = getInternalChildNodes(this);
|
|
1237
1191
|
return childNodes[0] || null;
|
|
1238
1192
|
}
|
|
1239
|
-
|
|
1240
1193
|
function lastChildGetterPatched() {
|
|
1241
1194
|
const childNodes = getInternalChildNodes(this);
|
|
1242
1195
|
return childNodes[childNodes.length - 1] || null;
|
|
1243
1196
|
}
|
|
1244
|
-
|
|
1245
1197
|
function textContentGetterPatched() {
|
|
1246
1198
|
return getTextContent(this);
|
|
1247
1199
|
}
|
|
1248
|
-
|
|
1249
1200
|
function textContentSetterPatched(value) {
|
|
1250
1201
|
textContextSetter.call(this, value);
|
|
1251
1202
|
}
|
|
1252
|
-
|
|
1253
1203
|
function parentNodeGetterPatched() {
|
|
1254
1204
|
const value = parentNodeGetter.call(this);
|
|
1255
|
-
|
|
1256
1205
|
if (isNull(value)) {
|
|
1257
1206
|
return value;
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1207
|
+
}
|
|
1208
|
+
// TODO [#1635]: this needs optimization, maybe implementing it based on this.assignedSlot
|
|
1261
1209
|
return getShadowParent(this, value);
|
|
1262
1210
|
}
|
|
1263
|
-
|
|
1264
1211
|
function parentElementGetterPatched() {
|
|
1265
1212
|
const value = parentNodeGetter.call(this);
|
|
1266
|
-
|
|
1267
1213
|
if (isNull(value)) {
|
|
1268
1214
|
return null;
|
|
1269
1215
|
}
|
|
1270
|
-
|
|
1271
|
-
|
|
1216
|
+
const parentNode = getShadowParent(this, value);
|
|
1217
|
+
// it could be that the parentNode is the shadowRoot, in which case
|
|
1272
1218
|
// we need to return null.
|
|
1273
1219
|
// TODO [#1635]: this needs optimization, maybe implementing it based on this.assignedSlot
|
|
1274
|
-
|
|
1275
1220
|
return parentNode instanceof Element ? parentNode : null;
|
|
1276
1221
|
}
|
|
1277
|
-
|
|
1278
1222
|
function compareDocumentPositionPatched(otherNode) {
|
|
1279
1223
|
if (this === otherNode) {
|
|
1280
1224
|
return 0;
|
|
@@ -1284,48 +1228,38 @@
|
|
|
1284
1228
|
} else if (getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
|
|
1285
1229
|
// "this" and "otherNode" belongs to 2 different shadow tree.
|
|
1286
1230
|
return 35; // Node.DOCUMENT_POSITION_DISCONNECTED | Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | Node.DOCUMENT_POSITION_PRECEDING
|
|
1287
|
-
}
|
|
1231
|
+
}
|
|
1232
|
+
// Since "this" and "otherNode" are part of the same shadow tree we can safely rely to the native
|
|
1288
1233
|
// Node.compareDocumentPosition implementation.
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
1234
|
return compareDocumentPosition.call(this, otherNode);
|
|
1292
1235
|
}
|
|
1293
|
-
|
|
1294
1236
|
function containsPatched(otherNode) {
|
|
1295
1237
|
if (otherNode == null || getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
|
|
1296
1238
|
// it is from another shadow
|
|
1297
1239
|
return false;
|
|
1298
1240
|
}
|
|
1299
|
-
|
|
1300
1241
|
return (compareDocumentPosition.call(this, otherNode) & DOCUMENT_POSITION_CONTAINED_BY) !== 0;
|
|
1301
1242
|
}
|
|
1302
|
-
|
|
1303
1243
|
function cloneNodePatched(deep) {
|
|
1304
|
-
const clone = cloneNode.call(this, false);
|
|
1244
|
+
const clone = cloneNode.call(this, false);
|
|
1245
|
+
// Per spec, browsers only care about truthy values
|
|
1305
1246
|
// Not strict true or false
|
|
1306
|
-
|
|
1307
1247
|
if (!deep) {
|
|
1308
1248
|
return clone;
|
|
1309
1249
|
}
|
|
1310
|
-
|
|
1311
1250
|
const childNodes = getInternalChildNodes(this);
|
|
1312
|
-
|
|
1313
1251
|
for (let i = 0, len = childNodes.length; i < len; i += 1) {
|
|
1314
1252
|
clone.appendChild(childNodes[i].cloneNode(true));
|
|
1315
1253
|
}
|
|
1316
|
-
|
|
1317
1254
|
return clone;
|
|
1318
1255
|
}
|
|
1319
1256
|
/**
|
|
1320
1257
|
* This method only applies to elements with a shadow or slots
|
|
1321
1258
|
*/
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
1259
|
function childNodesGetterPatched() {
|
|
1325
1260
|
if (isSyntheticShadowHost(this)) {
|
|
1326
1261
|
const owner = getNodeOwner(this);
|
|
1327
1262
|
const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
|
|
1328
|
-
|
|
1329
1263
|
if (process.env.NODE_ENV !== 'production' && isFalse(hasNativeSymbolSupport) && isExternalChildNodeAccessorFlagOn()) {
|
|
1330
1264
|
// inserting a comment node as the first childNode to trick the IE11
|
|
1331
1265
|
// DevTool to show the content of the shadowRoot, this should only happen
|
|
@@ -1333,30 +1267,24 @@
|
|
|
1333
1267
|
// Plus it should only be in place if we know it is an external invoker.
|
|
1334
1268
|
ArrayUnshift.call(childNodes, getIE11FakeShadowRootPlaceholder(this));
|
|
1335
1269
|
}
|
|
1336
|
-
|
|
1337
1270
|
return createStaticNodeList(childNodes);
|
|
1338
|
-
}
|
|
1271
|
+
}
|
|
1272
|
+
// nothing to do here since this does not have a synthetic shadow attached to it
|
|
1339
1273
|
// TODO [#1636]: what about slot elements?
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
1274
|
return childNodesGetter.call(this);
|
|
1343
1275
|
}
|
|
1344
|
-
|
|
1345
1276
|
const nativeGetRootNode = _Node.prototype.getRootNode;
|
|
1346
1277
|
/**
|
|
1347
1278
|
* Get the root by climbing up the dom tree, beyond the shadow root
|
|
1348
1279
|
* If Node.prototype.getRootNode is supported, use it
|
|
1349
1280
|
* else, assume we are working in non-native shadow mode and climb using parentNode
|
|
1350
1281
|
*/
|
|
1351
|
-
|
|
1352
1282
|
const getDocumentOrRootNode = !isUndefined(nativeGetRootNode) ? nativeGetRootNode : function () {
|
|
1353
1283
|
let node = this;
|
|
1354
1284
|
let nodeParent;
|
|
1355
|
-
|
|
1356
1285
|
while (!isNull(nodeParent = parentNodeGetter.call(node))) {
|
|
1357
1286
|
node = nodeParent;
|
|
1358
1287
|
}
|
|
1359
|
-
|
|
1360
1288
|
return node;
|
|
1361
1289
|
};
|
|
1362
1290
|
/**
|
|
@@ -1368,15 +1296,12 @@
|
|
|
1368
1296
|
* of a native shadow or the synthetic shadow.
|
|
1369
1297
|
* @param {Node} node
|
|
1370
1298
|
*/
|
|
1371
|
-
|
|
1372
1299
|
function getNearestRoot(node) {
|
|
1373
1300
|
const ownerNode = getNodeOwner(node);
|
|
1374
|
-
|
|
1375
1301
|
if (isNull(ownerNode)) {
|
|
1376
1302
|
// we hit a wall, either we are in native shadow mode or the node is not in lwc boundary.
|
|
1377
1303
|
return getDocumentOrRootNode.call(node);
|
|
1378
1304
|
}
|
|
1379
|
-
|
|
1380
1305
|
return getShadowRoot(ownerNode);
|
|
1381
1306
|
}
|
|
1382
1307
|
/**
|
|
@@ -1398,25 +1323,20 @@
|
|
|
1398
1323
|
* _Spec_: https://dom.spec.whatwg.org/#dom-node-getrootnode
|
|
1399
1324
|
*
|
|
1400
1325
|
**/
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
1326
|
function getRootNodePatched(options) {
|
|
1404
1327
|
const composed = isUndefined(options) ? false : !!options.composed;
|
|
1405
1328
|
return isTrue(composed) ? getDocumentOrRootNode.call(this, options) : getNearestRoot(this);
|
|
1406
|
-
}
|
|
1329
|
+
}
|
|
1330
|
+
// Non-deep-traversing patches: this descriptor map includes all descriptors that
|
|
1407
1331
|
// do not give access to nodes beyond the immediate children.
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
1332
|
defineProperties(_Node.prototype, {
|
|
1411
1333
|
firstChild: {
|
|
1412
1334
|
get() {
|
|
1413
1335
|
if (hasMountedChildren(this)) {
|
|
1414
1336
|
return firstChildGetterPatched.call(this);
|
|
1415
1337
|
}
|
|
1416
|
-
|
|
1417
1338
|
return firstChildGetter.call(this);
|
|
1418
1339
|
},
|
|
1419
|
-
|
|
1420
1340
|
enumerable: true,
|
|
1421
1341
|
configurable: true
|
|
1422
1342
|
},
|
|
@@ -1425,10 +1345,8 @@
|
|
|
1425
1345
|
if (hasMountedChildren(this)) {
|
|
1426
1346
|
return lastChildGetterPatched.call(this);
|
|
1427
1347
|
}
|
|
1428
|
-
|
|
1429
1348
|
return lastChildGetter.call(this);
|
|
1430
1349
|
},
|
|
1431
|
-
|
|
1432
1350
|
enumerable: true,
|
|
1433
1351
|
configurable: true
|
|
1434
1352
|
},
|
|
@@ -1438,18 +1356,14 @@
|
|
|
1438
1356
|
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
1439
1357
|
return textContentGetterPatched.call(this);
|
|
1440
1358
|
}
|
|
1441
|
-
|
|
1442
1359
|
return textContentGetter.call(this);
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
|
|
1360
|
+
}
|
|
1361
|
+
// TODO [#1222]: remove global bypass
|
|
1446
1362
|
if (isGlobalPatchingSkipped(this)) {
|
|
1447
1363
|
return textContentGetter.call(this);
|
|
1448
1364
|
}
|
|
1449
|
-
|
|
1450
1365
|
return textContentGetterPatched.call(this);
|
|
1451
1366
|
},
|
|
1452
|
-
|
|
1453
1367
|
set: textContentSetterPatched,
|
|
1454
1368
|
enumerable: true,
|
|
1455
1369
|
configurable: true
|
|
@@ -1459,17 +1373,14 @@
|
|
|
1459
1373
|
if (isNodeShadowed(this)) {
|
|
1460
1374
|
return parentNodeGetterPatched.call(this);
|
|
1461
1375
|
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1376
|
+
const parentNode = parentNodeGetter.call(this);
|
|
1377
|
+
// Handle the case where a top level light DOM element is slotted into a synthetic
|
|
1464
1378
|
// shadow slot.
|
|
1465
|
-
|
|
1466
1379
|
if (!isNull(parentNode) && isSyntheticSlotElement(parentNode)) {
|
|
1467
1380
|
return getNodeOwner(parentNode);
|
|
1468
1381
|
}
|
|
1469
|
-
|
|
1470
1382
|
return parentNode;
|
|
1471
1383
|
},
|
|
1472
|
-
|
|
1473
1384
|
enumerable: true,
|
|
1474
1385
|
configurable: true
|
|
1475
1386
|
},
|
|
@@ -1478,17 +1389,14 @@
|
|
|
1478
1389
|
if (isNodeShadowed(this)) {
|
|
1479
1390
|
return parentElementGetterPatched.call(this);
|
|
1480
1391
|
}
|
|
1481
|
-
|
|
1482
|
-
|
|
1392
|
+
const parentElement = parentElementGetter.call(this);
|
|
1393
|
+
// Handle the case where a top level light DOM element is slotted into a synthetic
|
|
1483
1394
|
// shadow slot.
|
|
1484
|
-
|
|
1485
1395
|
if (!isNull(parentElement) && isSyntheticSlotElement(parentElement)) {
|
|
1486
1396
|
return getNodeOwner(parentElement);
|
|
1487
1397
|
}
|
|
1488
|
-
|
|
1489
1398
|
return parentElement;
|
|
1490
1399
|
},
|
|
1491
|
-
|
|
1492
1400
|
enumerable: true,
|
|
1493
1401
|
configurable: true
|
|
1494
1402
|
},
|
|
@@ -1497,10 +1405,8 @@
|
|
|
1497
1405
|
if (hasMountedChildren(this)) {
|
|
1498
1406
|
return childNodesGetterPatched.call(this);
|
|
1499
1407
|
}
|
|
1500
|
-
|
|
1501
1408
|
return childNodesGetter.call(this);
|
|
1502
1409
|
},
|
|
1503
|
-
|
|
1504
1410
|
enumerable: true,
|
|
1505
1411
|
configurable: true
|
|
1506
1412
|
},
|
|
@@ -1509,10 +1415,8 @@
|
|
|
1509
1415
|
if (hasMountedChildren(this)) {
|
|
1510
1416
|
return hasChildNodesPatched.call(this);
|
|
1511
1417
|
}
|
|
1512
|
-
|
|
1513
1418
|
return hasChildNodes.call(this);
|
|
1514
1419
|
},
|
|
1515
|
-
|
|
1516
1420
|
enumerable: true,
|
|
1517
1421
|
writable: true,
|
|
1518
1422
|
configurable: true
|
|
@@ -1523,10 +1427,8 @@
|
|
|
1523
1427
|
if (isGlobalPatchingSkipped(this)) {
|
|
1524
1428
|
return compareDocumentPosition.call(this, otherNode);
|
|
1525
1429
|
}
|
|
1526
|
-
|
|
1527
1430
|
return compareDocumentPositionPatched.call(this, otherNode);
|
|
1528
1431
|
},
|
|
1529
|
-
|
|
1530
1432
|
enumerable: true,
|
|
1531
1433
|
writable: true,
|
|
1532
1434
|
configurable: true
|
|
@@ -1540,27 +1442,21 @@
|
|
|
1540
1442
|
if (this === otherNode) {
|
|
1541
1443
|
return true;
|
|
1542
1444
|
}
|
|
1543
|
-
|
|
1544
1445
|
if (!lwcRuntimeFlags.ENABLE_NODE_PATCH) {
|
|
1545
1446
|
if (otherNode == null) {
|
|
1546
1447
|
return false;
|
|
1547
1448
|
}
|
|
1548
|
-
|
|
1549
1449
|
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
1550
1450
|
return containsPatched.call(this, otherNode);
|
|
1551
1451
|
}
|
|
1552
|
-
|
|
1553
1452
|
return contains.call(this, otherNode);
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
|
|
1453
|
+
}
|
|
1454
|
+
// TODO [#1222]: remove global bypass
|
|
1557
1455
|
if (isGlobalPatchingSkipped(this)) {
|
|
1558
1456
|
return contains.call(this, otherNode);
|
|
1559
1457
|
}
|
|
1560
|
-
|
|
1561
1458
|
return containsPatched.call(this, otherNode);
|
|
1562
1459
|
},
|
|
1563
|
-
|
|
1564
1460
|
enumerable: true,
|
|
1565
1461
|
writable: true,
|
|
1566
1462
|
configurable: true
|
|
@@ -1571,22 +1467,17 @@
|
|
|
1571
1467
|
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
1572
1468
|
return cloneNodePatched.call(this, deep);
|
|
1573
1469
|
}
|
|
1574
|
-
|
|
1575
1470
|
return cloneNode.call(this, deep);
|
|
1576
1471
|
}
|
|
1577
|
-
|
|
1578
1472
|
if (isTrue(deep)) {
|
|
1579
1473
|
// TODO [#1222]: remove global bypass
|
|
1580
1474
|
if (isGlobalPatchingSkipped(this)) {
|
|
1581
1475
|
return cloneNode.call(this, deep);
|
|
1582
1476
|
}
|
|
1583
|
-
|
|
1584
1477
|
return cloneNodePatched.call(this, deep);
|
|
1585
1478
|
}
|
|
1586
|
-
|
|
1587
1479
|
return cloneNode.call(this, deep);
|
|
1588
1480
|
},
|
|
1589
|
-
|
|
1590
1481
|
enumerable: true,
|
|
1591
1482
|
writable: true,
|
|
1592
1483
|
configurable: true
|
|
@@ -1600,11 +1491,9 @@
|
|
|
1600
1491
|
isConnected: {
|
|
1601
1492
|
enumerable: true,
|
|
1602
1493
|
configurable: true,
|
|
1603
|
-
|
|
1604
1494
|
get() {
|
|
1605
1495
|
return isConnected.call(this);
|
|
1606
1496
|
}
|
|
1607
|
-
|
|
1608
1497
|
}
|
|
1609
1498
|
});
|
|
1610
1499
|
let internalChildNodeAccessorFlag = false;
|
|
@@ -1614,7 +1503,6 @@
|
|
|
1614
1503
|
* or from an external invoker. This helps to produce the right output in one very peculiar
|
|
1615
1504
|
* case, the IE11 debugging comment for shadowRoot representation on the devtool.
|
|
1616
1505
|
*/
|
|
1617
|
-
|
|
1618
1506
|
function isExternalChildNodeAccessorFlagOn() {
|
|
1619
1507
|
return !internalChildNodeAccessorFlag;
|
|
1620
1508
|
}
|
|
@@ -1622,7 +1510,6 @@
|
|
|
1622
1510
|
internalChildNodeAccessorFlag = true;
|
|
1623
1511
|
let childNodes;
|
|
1624
1512
|
let error = null;
|
|
1625
|
-
|
|
1626
1513
|
try {
|
|
1627
1514
|
childNodes = node.childNodes;
|
|
1628
1515
|
} catch (e) {
|
|
@@ -1630,7 +1517,6 @@
|
|
|
1630
1517
|
error = e;
|
|
1631
1518
|
} finally {
|
|
1632
1519
|
internalChildNodeAccessorFlag = false;
|
|
1633
|
-
|
|
1634
1520
|
if (!isNull(error)) {
|
|
1635
1521
|
// re-throwing after restoring the state machinery for setInternalChildNodeAccessorFlag
|
|
1636
1522
|
throw error; // eslint-disable-line no-unsafe-finally
|
|
@@ -1640,12 +1526,11 @@
|
|
|
1640
1526
|
return childNodes;
|
|
1641
1527
|
} : function (node) {
|
|
1642
1528
|
return node.childNodes;
|
|
1643
|
-
};
|
|
1644
|
-
|
|
1529
|
+
};
|
|
1530
|
+
// IE11 extra patches for wrong prototypes
|
|
1645
1531
|
if (hasOwnProperty.call(HTMLElement.prototype, 'contains')) {
|
|
1646
1532
|
defineProperty(HTMLElement.prototype, 'contains', getOwnPropertyDescriptor(_Node.prototype, 'contains'));
|
|
1647
1533
|
}
|
|
1648
|
-
|
|
1649
1534
|
if (hasOwnProperty.call(HTMLElement.prototype, 'parentElement')) {
|
|
1650
1535
|
defineProperty(HTMLElement.prototype, 'parentElement', getOwnPropertyDescriptor(_Node.prototype, 'parentElement'));
|
|
1651
1536
|
}
|
|
@@ -3804,66 +3689,52 @@
|
|
|
3804
3689
|
* SPDX-License-Identifier: MIT
|
|
3805
3690
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3806
3691
|
*/
|
|
3807
|
-
|
|
3808
3692
|
function innerHTMLGetterPatched() {
|
|
3809
3693
|
const childNodes = getInternalChildNodes(this);
|
|
3810
3694
|
let innerHTML = '';
|
|
3811
|
-
|
|
3812
3695
|
for (let i = 0, len = childNodes.length; i < len; i += 1) {
|
|
3813
3696
|
innerHTML += getOuterHTML(childNodes[i]);
|
|
3814
3697
|
}
|
|
3815
|
-
|
|
3816
3698
|
return innerHTML;
|
|
3817
3699
|
}
|
|
3818
|
-
|
|
3819
3700
|
function outerHTMLGetterPatched() {
|
|
3820
3701
|
return getOuterHTML(this);
|
|
3821
3702
|
}
|
|
3822
|
-
|
|
3823
3703
|
function attachShadowPatched(options) {
|
|
3824
3704
|
// To retain native behavior of the API, provide synthetic shadowRoot only when specified
|
|
3825
3705
|
if (options[KEY__SYNTHETIC_MODE]) {
|
|
3826
3706
|
return attachShadow(this, options);
|
|
3827
3707
|
}
|
|
3828
|
-
|
|
3829
3708
|
return attachShadow$1.call(this, options);
|
|
3830
3709
|
}
|
|
3831
|
-
|
|
3832
3710
|
function shadowRootGetterPatched() {
|
|
3833
3711
|
if (isSyntheticShadowHost(this)) {
|
|
3834
3712
|
const shadow = getShadowRoot(this);
|
|
3835
|
-
|
|
3836
3713
|
if (shadow.mode === 'open') {
|
|
3837
3714
|
return shadow;
|
|
3838
3715
|
}
|
|
3839
3716
|
}
|
|
3840
|
-
|
|
3841
3717
|
return shadowRootGetter.call(this);
|
|
3842
3718
|
}
|
|
3843
|
-
|
|
3844
3719
|
function childrenGetterPatched() {
|
|
3845
3720
|
const owner = getNodeOwner(this);
|
|
3846
3721
|
const childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
|
|
3847
3722
|
return createStaticHTMLCollection(ArrayFilter.call(childNodes, node => node instanceof Element));
|
|
3848
3723
|
}
|
|
3849
|
-
|
|
3850
3724
|
function childElementCountGetterPatched() {
|
|
3851
3725
|
return this.children.length;
|
|
3852
3726
|
}
|
|
3853
|
-
|
|
3854
3727
|
function firstElementChildGetterPatched() {
|
|
3855
3728
|
return this.children[0] || null;
|
|
3856
3729
|
}
|
|
3857
|
-
|
|
3858
3730
|
function lastElementChildGetterPatched() {
|
|
3859
3731
|
const {
|
|
3860
3732
|
children
|
|
3861
3733
|
} = this;
|
|
3862
3734
|
return children.item(children.length - 1) || null;
|
|
3863
|
-
}
|
|
3735
|
+
}
|
|
3736
|
+
// Non-deep-traversing patches: this descriptor map includes all descriptors that
|
|
3864
3737
|
// do not five access to nodes beyond the immediate children.
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
3738
|
defineProperties(Element.prototype, {
|
|
3868
3739
|
innerHTML: {
|
|
3869
3740
|
get() {
|
|
@@ -3871,22 +3742,17 @@
|
|
|
3871
3742
|
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
3872
3743
|
return innerHTMLGetterPatched.call(this);
|
|
3873
3744
|
}
|
|
3874
|
-
|
|
3875
3745
|
return innerHTMLGetter.call(this);
|
|
3876
|
-
}
|
|
3877
|
-
|
|
3878
|
-
|
|
3746
|
+
}
|
|
3747
|
+
// TODO [#1222]: remove global bypass
|
|
3879
3748
|
if (isGlobalPatchingSkipped(this)) {
|
|
3880
3749
|
return innerHTMLGetter.call(this);
|
|
3881
3750
|
}
|
|
3882
|
-
|
|
3883
3751
|
return innerHTMLGetterPatched.call(this);
|
|
3884
3752
|
},
|
|
3885
|
-
|
|
3886
3753
|
set(v) {
|
|
3887
3754
|
innerHTMLSetter.call(this, v);
|
|
3888
3755
|
},
|
|
3889
|
-
|
|
3890
3756
|
enumerable: true,
|
|
3891
3757
|
configurable: true
|
|
3892
3758
|
},
|
|
@@ -3896,22 +3762,17 @@
|
|
|
3896
3762
|
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
3897
3763
|
return outerHTMLGetterPatched.call(this);
|
|
3898
3764
|
}
|
|
3899
|
-
|
|
3900
3765
|
return outerHTMLGetter.call(this);
|
|
3901
|
-
}
|
|
3902
|
-
|
|
3903
|
-
|
|
3766
|
+
}
|
|
3767
|
+
// TODO [#1222]: remove global bypass
|
|
3904
3768
|
if (isGlobalPatchingSkipped(this)) {
|
|
3905
3769
|
return outerHTMLGetter.call(this);
|
|
3906
3770
|
}
|
|
3907
|
-
|
|
3908
3771
|
return outerHTMLGetterPatched.call(this);
|
|
3909
3772
|
},
|
|
3910
|
-
|
|
3911
3773
|
set(v) {
|
|
3912
3774
|
outerHTMLSetter.call(this, v);
|
|
3913
3775
|
},
|
|
3914
|
-
|
|
3915
3776
|
enumerable: true,
|
|
3916
3777
|
configurable: true
|
|
3917
3778
|
},
|
|
@@ -3932,10 +3793,8 @@
|
|
|
3932
3793
|
if (hasMountedChildren(this)) {
|
|
3933
3794
|
return childrenGetterPatched.call(this);
|
|
3934
3795
|
}
|
|
3935
|
-
|
|
3936
3796
|
return childrenGetter.call(this);
|
|
3937
3797
|
},
|
|
3938
|
-
|
|
3939
3798
|
enumerable: true,
|
|
3940
3799
|
configurable: true
|
|
3941
3800
|
},
|
|
@@ -3944,10 +3803,8 @@
|
|
|
3944
3803
|
if (hasMountedChildren(this)) {
|
|
3945
3804
|
return childElementCountGetterPatched.call(this);
|
|
3946
3805
|
}
|
|
3947
|
-
|
|
3948
3806
|
return childElementCountGetter.call(this);
|
|
3949
3807
|
},
|
|
3950
|
-
|
|
3951
3808
|
enumerable: true,
|
|
3952
3809
|
configurable: true
|
|
3953
3810
|
},
|
|
@@ -3956,10 +3813,8 @@
|
|
|
3956
3813
|
if (hasMountedChildren(this)) {
|
|
3957
3814
|
return firstElementChildGetterPatched.call(this);
|
|
3958
3815
|
}
|
|
3959
|
-
|
|
3960
3816
|
return firstElementChildGetter.call(this);
|
|
3961
3817
|
},
|
|
3962
|
-
|
|
3963
3818
|
enumerable: true,
|
|
3964
3819
|
configurable: true
|
|
3965
3820
|
},
|
|
@@ -3968,10 +3823,8 @@
|
|
|
3968
3823
|
if (hasMountedChildren(this)) {
|
|
3969
3824
|
return lastElementChildGetterPatched.call(this);
|
|
3970
3825
|
}
|
|
3971
|
-
|
|
3972
3826
|
return lastElementChildGetter.call(this);
|
|
3973
3827
|
},
|
|
3974
|
-
|
|
3975
3828
|
enumerable: true,
|
|
3976
3829
|
configurable: true
|
|
3977
3830
|
},
|
|
@@ -3980,28 +3833,23 @@
|
|
|
3980
3833
|
enumerable: true,
|
|
3981
3834
|
configurable: true
|
|
3982
3835
|
}
|
|
3983
|
-
});
|
|
3984
|
-
|
|
3836
|
+
});
|
|
3837
|
+
// IE11 extra patches for wrong prototypes
|
|
3985
3838
|
if (hasOwnProperty.call(HTMLElement.prototype, 'innerHTML')) {
|
|
3986
3839
|
defineProperty(HTMLElement.prototype, 'innerHTML', getOwnPropertyDescriptor(Element.prototype, 'innerHTML'));
|
|
3987
3840
|
}
|
|
3988
|
-
|
|
3989
3841
|
if (hasOwnProperty.call(HTMLElement.prototype, 'outerHTML')) {
|
|
3990
3842
|
defineProperty(HTMLElement.prototype, 'outerHTML', getOwnPropertyDescriptor(Element.prototype, 'outerHTML'));
|
|
3991
3843
|
}
|
|
3992
|
-
|
|
3993
3844
|
if (hasOwnProperty.call(HTMLElement.prototype, 'children')) {
|
|
3994
3845
|
defineProperty(HTMLElement.prototype, 'children', getOwnPropertyDescriptor(Element.prototype, 'children'));
|
|
3995
|
-
}
|
|
3996
|
-
|
|
3997
|
-
|
|
3846
|
+
}
|
|
3847
|
+
// Deep-traversing patches from this point on:
|
|
3998
3848
|
function querySelectorPatched() {
|
|
3999
3849
|
const nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
|
|
4000
|
-
|
|
4001
3850
|
if (isSyntheticShadowHost(this)) {
|
|
4002
3851
|
// element with shadowRoot attached
|
|
4003
3852
|
const owner = getNodeOwner(this);
|
|
4004
|
-
|
|
4005
3853
|
if (!isUndefined(getNodeKey(this))) {
|
|
4006
3854
|
// it is a custom element, and we should then filter by slotted elements
|
|
4007
3855
|
return getFirstSlottedMatch(this, nodeList);
|
|
@@ -4014,7 +3862,6 @@
|
|
|
4014
3862
|
} else if (isNodeShadowed(this)) {
|
|
4015
3863
|
// element inside a shadowRoot
|
|
4016
3864
|
const ownerKey = getNodeOwnerKey(this);
|
|
4017
|
-
|
|
4018
3865
|
if (!isUndefined(ownerKey)) {
|
|
4019
3866
|
// `this` is handled by lwc, using getNodeNearestOwnerKey to include manually inserted elements in the same shadow.
|
|
4020
3867
|
const elm = ArrayFind.call(nodeList, elm => getNodeNearestOwnerKey(elm) === ownerKey);
|
|
@@ -4023,10 +3870,9 @@
|
|
|
4023
3870
|
if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
|
|
4024
3871
|
// `this` is a manually inserted element inside a shadowRoot, return the first element.
|
|
4025
3872
|
return nodeList.length === 0 ? null : nodeList[0];
|
|
4026
|
-
}
|
|
3873
|
+
}
|
|
3874
|
+
// Element is inside a shadow but we dont know which one. Use the
|
|
4027
3875
|
// "nearest" owner key to filter by ownership.
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
3876
|
const contextNearestOwnerKey = getNodeNearestOwnerKey(this);
|
|
4031
3877
|
const elm = ArrayFind.call(nodeList, elm => getNodeNearestOwnerKey(elm) === contextNearestOwnerKey);
|
|
4032
3878
|
return isUndefined(elm) ? null : elm;
|
|
@@ -4037,22 +3883,19 @@
|
|
|
4037
3883
|
const elm = nodeList[0];
|
|
4038
3884
|
return isUndefined(elm) ? null : elm;
|
|
4039
3885
|
}
|
|
4040
|
-
}
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
3886
|
+
}
|
|
3887
|
+
// element belonging to the document
|
|
3888
|
+
const elm = ArrayFind.call(nodeList,
|
|
3889
|
+
// TODO [#1222]: remove global bypass
|
|
4044
3890
|
elm => isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(this));
|
|
4045
3891
|
return isUndefined(elm) ? null : elm;
|
|
4046
3892
|
}
|
|
4047
3893
|
}
|
|
4048
|
-
|
|
4049
3894
|
function getFilteredArrayOfNodes(context, unfilteredNodes, shadowDomSemantic) {
|
|
4050
3895
|
let filtered;
|
|
4051
|
-
|
|
4052
3896
|
if (isSyntheticShadowHost(context)) {
|
|
4053
3897
|
// element with shadowRoot attached
|
|
4054
3898
|
const owner = getNodeOwner(context);
|
|
4055
|
-
|
|
4056
3899
|
if (!isUndefined(getNodeKey(context))) {
|
|
4057
3900
|
// it is a custom element, and we should then filter by slotted elements
|
|
4058
3901
|
filtered = getAllSlottedMatches(context, unfilteredNodes);
|
|
@@ -4065,13 +3908,10 @@
|
|
|
4065
3908
|
} else if (isNodeShadowed(context)) {
|
|
4066
3909
|
// element inside a shadowRoot
|
|
4067
3910
|
const ownerKey = getNodeOwnerKey(context);
|
|
4068
|
-
|
|
4069
3911
|
if (!isUndefined(ownerKey)) {
|
|
4070
3912
|
// context is handled by lwc, using getNodeNearestOwnerKey to include manually inserted elements in the same shadow.
|
|
4071
3913
|
filtered = ArrayFilter.call(unfilteredNodes, elm => getNodeNearestOwnerKey(elm) === ownerKey);
|
|
4072
|
-
} else if (shadowDomSemantic === 1
|
|
4073
|
-
/* ShadowDomSemantic.Enabled */
|
|
4074
|
-
) {
|
|
3914
|
+
} else if (shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
|
|
4075
3915
|
// context is inside a shadow, we dont know which one.
|
|
4076
3916
|
const contextNearestOwnerKey = getNodeNearestOwnerKey(context);
|
|
4077
3917
|
filtered = ArrayFilter.call(unfilteredNodes, elm => getNodeNearestOwnerKey(elm) === contextNearestOwnerKey);
|
|
@@ -4080,20 +3920,19 @@
|
|
|
4080
3920
|
filtered = ArraySlice.call(unfilteredNodes);
|
|
4081
3921
|
}
|
|
4082
3922
|
} else {
|
|
4083
|
-
if (context instanceof HTMLBodyElement || shadowDomSemantic === 1
|
|
4084
|
-
/* ShadowDomSemantic.Enabled */
|
|
4085
|
-
) {
|
|
3923
|
+
if (context instanceof HTMLBodyElement || shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
|
|
4086
3924
|
// `context` is document.body or element belonging to the document with the patch enabled
|
|
4087
|
-
filtered = ArrayFilter.call(unfilteredNodes,
|
|
3925
|
+
filtered = ArrayFilter.call(unfilteredNodes,
|
|
3926
|
+
// TODO [#1222]: remove global bypass
|
|
4088
3927
|
elm => isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(context));
|
|
4089
3928
|
} else {
|
|
4090
3929
|
// `context` is outside the lwc boundary and patch is not enabled.
|
|
4091
3930
|
filtered = ArraySlice.call(unfilteredNodes);
|
|
4092
3931
|
}
|
|
4093
3932
|
}
|
|
4094
|
-
|
|
4095
3933
|
return filtered;
|
|
4096
|
-
}
|
|
3934
|
+
}
|
|
3935
|
+
// The following patched methods hide shadowed elements from global
|
|
4097
3936
|
// traversing mechanisms. They are simplified for performance reasons to
|
|
4098
3937
|
// filter by ownership and do not account for slotted elements. This
|
|
4099
3938
|
// compromise is fine for our synthetic shadow dom because root elements
|
|
@@ -4102,8 +3941,6 @@
|
|
|
4102
3941
|
// static HTMLCollection or static NodeList. We decided that this compromise
|
|
4103
3942
|
// is not a big problem considering the amount of code that is relying on
|
|
4104
3943
|
// the liveliness of these results are rare.
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
3944
|
defineProperties(Element.prototype, {
|
|
4108
3945
|
querySelector: {
|
|
4109
3946
|
value: querySelectorPatched,
|
|
@@ -4114,41 +3951,30 @@
|
|
|
4114
3951
|
querySelectorAll: {
|
|
4115
3952
|
value() {
|
|
4116
3953
|
const nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
|
|
4117
|
-
|
|
4118
3954
|
if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
|
|
4119
|
-
const filteredResults = getFilteredArrayOfNodes(this, nodeList, 0
|
|
4120
|
-
/* ShadowDomSemantic.Disabled */
|
|
4121
|
-
);
|
|
3955
|
+
const filteredResults = getFilteredArrayOfNodes(this, nodeList, 0 /* ShadowDomSemantic.Disabled */);
|
|
4122
3956
|
return createStaticNodeList(filteredResults);
|
|
4123
3957
|
}
|
|
4124
|
-
|
|
4125
|
-
return createStaticNodeList(getFilteredArrayOfNodes(this, nodeList, 1
|
|
4126
|
-
/* ShadowDomSemantic.Enabled */
|
|
4127
|
-
));
|
|
3958
|
+
return createStaticNodeList(getFilteredArrayOfNodes(this, nodeList, 1 /* ShadowDomSemantic.Enabled */));
|
|
4128
3959
|
},
|
|
4129
3960
|
|
|
4130
3961
|
writable: true,
|
|
4131
3962
|
enumerable: true,
|
|
4132
3963
|
configurable: true
|
|
4133
3964
|
}
|
|
4134
|
-
});
|
|
4135
|
-
|
|
3965
|
+
});
|
|
3966
|
+
// The following APIs are used directly by Jest internally so we avoid patching them during testing.
|
|
4136
3967
|
if (process.env.NODE_ENV !== 'test') {
|
|
4137
3968
|
defineProperties(Element.prototype, {
|
|
4138
3969
|
getElementsByClassName: {
|
|
4139
3970
|
value() {
|
|
4140
3971
|
const elements = arrayFromCollection(getElementsByClassName$1.apply(this, ArraySlice.call(arguments)));
|
|
4141
|
-
|
|
4142
3972
|
if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
|
|
4143
3973
|
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
4144
3974
|
}
|
|
4145
|
-
|
|
4146
|
-
const filteredResults = getFilteredArrayOfNodes(this, elements, 1
|
|
4147
|
-
/* ShadowDomSemantic.Enabled */
|
|
4148
|
-
);
|
|
3975
|
+
const filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
|
|
4149
3976
|
return createStaticHTMLCollection(filteredResults);
|
|
4150
3977
|
},
|
|
4151
|
-
|
|
4152
3978
|
writable: true,
|
|
4153
3979
|
enumerable: true,
|
|
4154
3980
|
configurable: true
|
|
@@ -4156,17 +3982,12 @@
|
|
|
4156
3982
|
getElementsByTagName: {
|
|
4157
3983
|
value() {
|
|
4158
3984
|
const elements = arrayFromCollection(getElementsByTagName$1.apply(this, ArraySlice.call(arguments)));
|
|
4159
|
-
|
|
4160
3985
|
if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
|
|
4161
3986
|
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
4162
3987
|
}
|
|
4163
|
-
|
|
4164
|
-
const filteredResults = getFilteredArrayOfNodes(this, elements, 1
|
|
4165
|
-
/* ShadowDomSemantic.Enabled */
|
|
4166
|
-
);
|
|
3988
|
+
const filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
|
|
4167
3989
|
return createStaticHTMLCollection(filteredResults);
|
|
4168
3990
|
},
|
|
4169
|
-
|
|
4170
3991
|
writable: true,
|
|
4171
3992
|
enumerable: true,
|
|
4172
3993
|
configurable: true
|
|
@@ -4174,25 +3995,19 @@
|
|
|
4174
3995
|
getElementsByTagNameNS: {
|
|
4175
3996
|
value() {
|
|
4176
3997
|
const elements = arrayFromCollection(getElementsByTagNameNS$1.apply(this, ArraySlice.call(arguments)));
|
|
4177
|
-
|
|
4178
3998
|
if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
|
|
4179
3999
|
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
4180
4000
|
}
|
|
4181
|
-
|
|
4182
|
-
const filteredResults = getFilteredArrayOfNodes(this, elements, 1
|
|
4183
|
-
/* ShadowDomSemantic.Enabled */
|
|
4184
|
-
);
|
|
4001
|
+
const filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
|
|
4185
4002
|
return createStaticHTMLCollection(filteredResults);
|
|
4186
4003
|
},
|
|
4187
|
-
|
|
4188
4004
|
writable: true,
|
|
4189
4005
|
enumerable: true,
|
|
4190
4006
|
configurable: true
|
|
4191
4007
|
}
|
|
4192
4008
|
});
|
|
4193
|
-
}
|
|
4194
|
-
|
|
4195
|
-
|
|
4009
|
+
}
|
|
4010
|
+
// IE11 extra patches for wrong prototypes
|
|
4196
4011
|
if (hasOwnProperty.call(HTMLElement.prototype, 'getElementsByClassName')) {
|
|
4197
4012
|
defineProperty(HTMLElement.prototype, 'getElementsByClassName', getOwnPropertyDescriptor(Element.prototype, 'getElementsByClassName'));
|
|
4198
4013
|
}
|
|
@@ -4740,21 +4555,17 @@
|
|
|
4740
4555
|
/**
|
|
4741
4556
|
* This method only applies to elements with a shadow attached to them
|
|
4742
4557
|
*/
|
|
4743
|
-
|
|
4744
4558
|
function tabIndexGetterPatched() {
|
|
4745
4559
|
if (isDelegatingFocus(this) && isFalse(hasAttribute.call(this, 'tabindex'))) {
|
|
4746
4560
|
// this covers the case where the default tabindex should be 0 because the
|
|
4747
4561
|
// custom element is delegating its focus
|
|
4748
4562
|
return 0;
|
|
4749
4563
|
}
|
|
4750
|
-
|
|
4751
4564
|
return tabIndexGetter.call(this);
|
|
4752
4565
|
}
|
|
4753
4566
|
/**
|
|
4754
4567
|
* This method only applies to elements with a shadow attached to them
|
|
4755
4568
|
*/
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
4569
|
function tabIndexSetterPatched(value) {
|
|
4759
4570
|
// This tabIndex setter might be confusing unless it is understood that HTML
|
|
4760
4571
|
// elements have default tabIndex property values. Natively focusable elements have
|
|
@@ -4762,53 +4573,48 @@
|
|
|
4762
4573
|
// value of -1. For example, the tabIndex property value is -1 for both <x-foo> and
|
|
4763
4574
|
// <x-foo tabindex="-1">, but our delegatesFocus polyfill should only kick in for
|
|
4764
4575
|
// the latter case when the value of the tabindex attribute is -1.
|
|
4765
|
-
const delegatesFocus = isDelegatingFocus(this);
|
|
4766
|
-
|
|
4576
|
+
const delegatesFocus = isDelegatingFocus(this);
|
|
4577
|
+
// Record the state of things before invoking component setter.
|
|
4767
4578
|
const prevValue = tabIndexGetter.call(this);
|
|
4768
4579
|
const prevHasAttr = hasAttribute.call(this, 'tabindex');
|
|
4769
|
-
tabIndexSetter.call(this, value);
|
|
4770
|
-
|
|
4580
|
+
tabIndexSetter.call(this, value);
|
|
4581
|
+
// Record the state of things after invoking component setter.
|
|
4771
4582
|
const currValue = tabIndexGetter.call(this);
|
|
4772
4583
|
const currHasAttr = hasAttribute.call(this, 'tabindex');
|
|
4773
|
-
const didValueChange = prevValue !== currValue;
|
|
4584
|
+
const didValueChange = prevValue !== currValue;
|
|
4585
|
+
// If the tabindex attribute is initially rendered, we can assume that this setter has
|
|
4774
4586
|
// previously executed and a listener has been added. We must remove that listener if
|
|
4775
4587
|
// the tabIndex property value has changed or if the component no longer renders a
|
|
4776
4588
|
// tabindex attribute.
|
|
4777
|
-
|
|
4778
4589
|
if (prevHasAttr && (didValueChange || isFalse(currHasAttr))) {
|
|
4779
4590
|
if (prevValue === -1) {
|
|
4780
4591
|
ignoreFocusIn(this);
|
|
4781
4592
|
}
|
|
4782
|
-
|
|
4783
4593
|
if (prevValue === 0 && delegatesFocus) {
|
|
4784
4594
|
ignoreFocus(this);
|
|
4785
4595
|
}
|
|
4786
|
-
}
|
|
4596
|
+
}
|
|
4597
|
+
// If a tabindex attribute was not rendered after invoking its setter, it means the
|
|
4787
4598
|
// component is taking control. Do nothing.
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
4599
|
if (isFalse(currHasAttr)) {
|
|
4791
4600
|
return;
|
|
4792
|
-
}
|
|
4601
|
+
}
|
|
4602
|
+
// If the tabindex attribute is initially rendered, we can assume that this setter has
|
|
4793
4603
|
// previously executed and a listener has been added. If the tabindex attribute is still
|
|
4794
4604
|
// rendered after invoking the setter AND the tabIndex property value has not changed,
|
|
4795
4605
|
// we don't need to do any work.
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
4606
|
if (prevHasAttr && currHasAttr && isFalse(didValueChange)) {
|
|
4799
4607
|
return;
|
|
4800
|
-
}
|
|
4608
|
+
}
|
|
4609
|
+
// At this point we know that a tabindex attribute was rendered after invoking the
|
|
4801
4610
|
// setter and that either:
|
|
4802
4611
|
// 1) This is the first time this setter is being invoked.
|
|
4803
4612
|
// 2) This is not the first time this setter is being invoked and the value is changing.
|
|
4804
4613
|
// We need to add the appropriate listeners in either case.
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
4614
|
if (currValue === -1) {
|
|
4808
4615
|
// Add the magic to skip the shadow tree
|
|
4809
4616
|
handleFocusIn(this);
|
|
4810
4617
|
}
|
|
4811
|
-
|
|
4812
4618
|
if (currValue === 0 && delegatesFocus) {
|
|
4813
4619
|
// Add the magic to skip the host element
|
|
4814
4620
|
handleFocus(this);
|
|
@@ -4817,64 +4623,52 @@
|
|
|
4817
4623
|
/**
|
|
4818
4624
|
* This method only applies to elements with a shadow attached to them
|
|
4819
4625
|
*/
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
4626
|
function blurPatched() {
|
|
4823
4627
|
if (isDelegatingFocus(this)) {
|
|
4824
4628
|
const currentActiveElement = getActiveElement(this);
|
|
4825
|
-
|
|
4826
4629
|
if (!isNull(currentActiveElement)) {
|
|
4827
4630
|
// if there is an active element, blur it (intentionally using the dot notation in case the user defines the blur routine)
|
|
4828
4631
|
currentActiveElement.blur();
|
|
4829
4632
|
return;
|
|
4830
4633
|
}
|
|
4831
4634
|
}
|
|
4832
|
-
|
|
4833
4635
|
return blur.call(this);
|
|
4834
4636
|
}
|
|
4835
|
-
|
|
4836
4637
|
function focusPatched() {
|
|
4837
4638
|
// Save enabled state
|
|
4838
|
-
const originallyEnabled = isKeyboardFocusNavigationRoutineEnabled();
|
|
4839
|
-
|
|
4639
|
+
const originallyEnabled = isKeyboardFocusNavigationRoutineEnabled();
|
|
4640
|
+
// Change state by disabling if originally enabled
|
|
4840
4641
|
if (originallyEnabled) {
|
|
4841
4642
|
disableKeyboardFocusNavigationRoutines();
|
|
4842
4643
|
}
|
|
4843
|
-
|
|
4844
4644
|
if (isSyntheticShadowHost(this) && isDelegatingFocus(this)) {
|
|
4845
4645
|
hostElementFocus.call(this);
|
|
4846
4646
|
return;
|
|
4847
|
-
}
|
|
4647
|
+
}
|
|
4648
|
+
// Typescript does not like it when you treat the `arguments` object as an array
|
|
4848
4649
|
// @ts-ignore type-mismatch
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
focus.apply(this, arguments); // Restore state by enabling if originally enabled
|
|
4852
|
-
|
|
4650
|
+
focus.apply(this, arguments);
|
|
4651
|
+
// Restore state by enabling if originally enabled
|
|
4853
4652
|
if (originallyEnabled) {
|
|
4854
4653
|
enableKeyboardFocusNavigationRoutines();
|
|
4855
4654
|
}
|
|
4856
|
-
}
|
|
4655
|
+
}
|
|
4656
|
+
// Non-deep-traversing patches: this descriptor map includes all descriptors that
|
|
4857
4657
|
// do not five access to nodes beyond the immediate children.
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
4658
|
defineProperties(HTMLElement.prototype, {
|
|
4861
4659
|
tabIndex: {
|
|
4862
4660
|
get() {
|
|
4863
4661
|
if (isSyntheticShadowHost(this)) {
|
|
4864
4662
|
return tabIndexGetterPatched.call(this);
|
|
4865
4663
|
}
|
|
4866
|
-
|
|
4867
4664
|
return tabIndexGetter.call(this);
|
|
4868
4665
|
},
|
|
4869
|
-
|
|
4870
4666
|
set(v) {
|
|
4871
4667
|
if (isSyntheticShadowHost(this)) {
|
|
4872
4668
|
return tabIndexSetterPatched.call(this, v);
|
|
4873
4669
|
}
|
|
4874
|
-
|
|
4875
4670
|
return tabIndexSetter.call(this, v);
|
|
4876
4671
|
},
|
|
4877
|
-
|
|
4878
4672
|
enumerable: true,
|
|
4879
4673
|
configurable: true
|
|
4880
4674
|
},
|
|
@@ -4883,10 +4677,8 @@
|
|
|
4883
4677
|
if (isSyntheticShadowHost(this)) {
|
|
4884
4678
|
return blurPatched.call(this);
|
|
4885
4679
|
}
|
|
4886
|
-
|
|
4887
4680
|
blur.call(this);
|
|
4888
4681
|
},
|
|
4889
|
-
|
|
4890
4682
|
enumerable: true,
|
|
4891
4683
|
writable: true,
|
|
4892
4684
|
configurable: true
|
|
@@ -4897,46 +4689,38 @@
|
|
|
4897
4689
|
// @ts-ignore type-mismatch
|
|
4898
4690
|
focusPatched.apply(this, arguments);
|
|
4899
4691
|
},
|
|
4900
|
-
|
|
4901
4692
|
enumerable: true,
|
|
4902
4693
|
writable: true,
|
|
4903
4694
|
configurable: true
|
|
4904
4695
|
}
|
|
4905
|
-
});
|
|
4906
|
-
|
|
4696
|
+
});
|
|
4697
|
+
// Note: In JSDOM innerText is not implemented: https://github.com/jsdom/jsdom/issues/1245
|
|
4907
4698
|
if (innerTextGetter !== null && innerTextSetter !== null) {
|
|
4908
4699
|
defineProperty(HTMLElement.prototype, 'innerText', {
|
|
4909
4700
|
get() {
|
|
4910
4701
|
if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
|
|
4911
4702
|
return innerTextGetter.call(this);
|
|
4912
4703
|
}
|
|
4913
|
-
|
|
4914
4704
|
if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
4915
4705
|
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
4916
4706
|
return getInnerText(this);
|
|
4917
4707
|
}
|
|
4918
|
-
|
|
4919
4708
|
return innerTextGetter.call(this);
|
|
4920
|
-
}
|
|
4921
|
-
|
|
4922
|
-
|
|
4709
|
+
}
|
|
4710
|
+
// TODO [#1222]: remove global bypass
|
|
4923
4711
|
if (isGlobalPatchingSkipped(this)) {
|
|
4924
4712
|
return innerTextGetter.call(this);
|
|
4925
4713
|
}
|
|
4926
|
-
|
|
4927
4714
|
return getInnerText(this);
|
|
4928
4715
|
},
|
|
4929
|
-
|
|
4930
4716
|
set(v) {
|
|
4931
4717
|
innerTextSetter.call(this, v);
|
|
4932
4718
|
},
|
|
4933
|
-
|
|
4934
4719
|
enumerable: true,
|
|
4935
4720
|
configurable: true
|
|
4936
4721
|
});
|
|
4937
|
-
}
|
|
4938
|
-
|
|
4939
|
-
|
|
4722
|
+
}
|
|
4723
|
+
// Note: Firefox does not have outerText, https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText
|
|
4940
4724
|
if (outerTextGetter !== null && outerTextSetter !== null) {
|
|
4941
4725
|
// From https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText :
|
|
4942
4726
|
// HTMLElement.outerText is a non-standard property. As a getter, it returns the same value as Node.innerText.
|
|
@@ -4946,30 +4730,24 @@
|
|
|
4946
4730
|
if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
|
|
4947
4731
|
return outerTextGetter.call(this);
|
|
4948
4732
|
}
|
|
4949
|
-
|
|
4950
4733
|
if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
4951
4734
|
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
4952
4735
|
return getInnerText(this);
|
|
4953
4736
|
}
|
|
4954
|
-
|
|
4955
4737
|
return outerTextGetter.call(this);
|
|
4956
|
-
}
|
|
4957
|
-
|
|
4958
|
-
|
|
4738
|
+
}
|
|
4739
|
+
// TODO [#1222]: remove global bypass
|
|
4959
4740
|
if (isGlobalPatchingSkipped(this)) {
|
|
4960
4741
|
return outerTextGetter.call(this);
|
|
4961
4742
|
}
|
|
4962
|
-
|
|
4963
4743
|
return getInnerText(this);
|
|
4964
4744
|
},
|
|
4965
|
-
|
|
4966
4745
|
set(v) {
|
|
4967
4746
|
// Invoking the `outerText` setter on a host element should trigger its disconnection, but until we merge node reactions, it will not work.
|
|
4968
4747
|
// We could reimplement the outerText setter in JavaScript ([blink implementation](https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/html/html_element.cc;l=841-879;drc=6e8b402a6231405b753919029c9027404325ea00;bpv=0;bpt=1))
|
|
4969
4748
|
// but the benefits don't worth the efforts.
|
|
4970
4749
|
outerTextSetter.call(this, v);
|
|
4971
4750
|
},
|
|
4972
|
-
|
|
4973
4751
|
enumerable: true,
|
|
4974
4752
|
configurable: true
|
|
4975
4753
|
});
|
|
@@ -5155,16 +4933,14 @@
|
|
|
5155
4933
|
* SPDX-License-Identifier: MIT
|
|
5156
4934
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5157
4935
|
*/
|
|
4936
|
+
// Only used in LWC's Karma tests
|
|
5158
4937
|
// @ts-ignore
|
|
5159
|
-
|
|
5160
4938
|
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
5161
4939
|
window.addEventListener('test-dummy-flag', () => {
|
|
5162
4940
|
let hasFlag = false;
|
|
5163
|
-
|
|
5164
4941
|
if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
|
|
5165
4942
|
hasFlag = true;
|
|
5166
4943
|
}
|
|
5167
|
-
|
|
5168
4944
|
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
5169
4945
|
detail: {
|
|
5170
4946
|
package: '@lwc/synthetic-shadow',
|
|
@@ -5173,6 +4949,6 @@
|
|
|
5173
4949
|
}));
|
|
5174
4950
|
});
|
|
5175
4951
|
}
|
|
5176
|
-
/** version: 2.
|
|
4952
|
+
/** version: 2.30.0 */
|
|
5177
4953
|
|
|
5178
4954
|
})();
|