@lwc/synthetic-shadow 6.1.1 → 6.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/faux-shadow/events.d.ts +1 -0
- package/dist/faux-shadow/no-patch-utils.d.ts +2 -0
- package/dist/faux-shadow/node.d.ts +1 -0
- package/dist/index.cjs.js +161 -61
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +161 -61
- package/dist/index.js.map +1 -1
- package/dist/shared/node-ownership.d.ts +1 -0
- package/dist/shared/utils.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -14,21 +14,40 @@ if (!lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
|
|
14
14
|
* SPDX-License-Identifier: MIT
|
15
15
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
16
16
|
*/
|
17
|
+
/**
|
18
|
+
*
|
19
|
+
* @param value
|
20
|
+
* @param msg
|
21
|
+
*/
|
17
22
|
function invariant(value, msg) {
|
18
23
|
if (!value) {
|
19
24
|
throw new Error(`Invariant Violation: ${msg}`);
|
20
25
|
}
|
21
26
|
}
|
27
|
+
/**
|
28
|
+
*
|
29
|
+
* @param value
|
30
|
+
* @param msg
|
31
|
+
*/
|
22
32
|
function isTrue$1(value, msg) {
|
23
33
|
if (!value) {
|
24
34
|
throw new Error(`Assert Violation: ${msg}`);
|
25
35
|
}
|
26
36
|
}
|
37
|
+
/**
|
38
|
+
*
|
39
|
+
* @param value
|
40
|
+
* @param msg
|
41
|
+
*/
|
27
42
|
function isFalse$1(value, msg) {
|
28
43
|
if (value) {
|
29
44
|
throw new Error(`Assert Violation: ${msg}`);
|
30
45
|
}
|
31
46
|
}
|
47
|
+
/**
|
48
|
+
*
|
49
|
+
* @param msg
|
50
|
+
*/
|
32
51
|
function fail(msg) {
|
33
52
|
throw new Error(msg);
|
34
53
|
}
|
@@ -42,48 +61,132 @@ var assert = /*#__PURE__*/Object.freeze({
|
|
42
61
|
});
|
43
62
|
|
44
63
|
/*
|
45
|
-
* Copyright (c)
|
64
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
46
65
|
* All rights reserved.
|
47
66
|
* SPDX-License-Identifier: MIT
|
48
67
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
49
68
|
*/
|
50
|
-
const {
|
69
|
+
const {
|
70
|
+
/** Detached {@linkcode Object.assign}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign MDN Reference}. */
|
71
|
+
assign,
|
72
|
+
/** Detached {@linkcode Object.create}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create MDN Reference}. */
|
73
|
+
create,
|
74
|
+
/** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */
|
75
|
+
defineProperties,
|
76
|
+
/** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */
|
77
|
+
defineProperty,
|
78
|
+
/** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
|
79
|
+
entries,
|
80
|
+
/** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */
|
81
|
+
freeze,
|
82
|
+
/** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */
|
83
|
+
getOwnPropertyDescriptor,
|
84
|
+
/** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */
|
85
|
+
getOwnPropertyDescriptors,
|
86
|
+
/** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
|
87
|
+
getOwnPropertyNames,
|
88
|
+
/** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */
|
89
|
+
getPrototypeOf,
|
90
|
+
/** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */
|
91
|
+
hasOwnProperty,
|
92
|
+
/** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */
|
93
|
+
isFrozen,
|
94
|
+
/** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */
|
95
|
+
keys,
|
96
|
+
/** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */
|
97
|
+
seal,
|
98
|
+
/** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */
|
99
|
+
setPrototypeOf, } = Object;
|
100
|
+
/** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
|
51
101
|
const { isArray } = Array;
|
52
|
-
|
102
|
+
// For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
|
103
|
+
// though it works fine for one, e.g. isArray), so comments for these are added to the export
|
104
|
+
// statement, rather than this declaration.
|
105
|
+
const { concat: ArrayConcat, copyWithin: ArrayCopyWithin, every: ArrayEvery, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, includes: ArrayIncludes, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, // Weird anomaly!
|
106
|
+
} = Array.prototype;
|
107
|
+
/**
|
108
|
+
* Determines whether the argument is `undefined`.
|
109
|
+
* @param obj Value to test
|
110
|
+
* @returns `true` if the value is `undefined`.
|
111
|
+
*/
|
53
112
|
function isUndefined(obj) {
|
54
113
|
return obj === undefined;
|
55
114
|
}
|
115
|
+
/**
|
116
|
+
* Determines whether the argument is `null`.
|
117
|
+
* @param obj Value to test
|
118
|
+
* @returns `true` if the value is `null`.
|
119
|
+
*/
|
56
120
|
function isNull(obj) {
|
57
121
|
return obj === null;
|
58
122
|
}
|
123
|
+
/**
|
124
|
+
* Determines whether the argument is `true`.
|
125
|
+
* @param obj Value to test
|
126
|
+
* @returns `true` if the value is `true`.
|
127
|
+
*/
|
59
128
|
function isTrue(obj) {
|
60
129
|
return obj === true;
|
61
130
|
}
|
131
|
+
/**
|
132
|
+
* Determines whether the argument is `false`.
|
133
|
+
* @param obj Value to test
|
134
|
+
* @returns `true` if the value is `false`.
|
135
|
+
*/
|
62
136
|
function isFalse(obj) {
|
63
137
|
return obj === false;
|
64
138
|
}
|
139
|
+
/**
|
140
|
+
* Determines whether the argument is a function.
|
141
|
+
* @param obj Value to test
|
142
|
+
* @returns `true` if the value is a function.
|
143
|
+
*/
|
144
|
+
// Replacing `Function` with a narrower type that works for all our use cases is tricky...
|
145
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
65
146
|
function isFunction(obj) {
|
66
147
|
return typeof obj === 'function';
|
67
148
|
}
|
149
|
+
/**
|
150
|
+
* Determines whether the argument is an object or null.
|
151
|
+
* @param obj Value to test
|
152
|
+
* @returns `true` if the value is an object or null.
|
153
|
+
*/
|
68
154
|
function isObject(obj) {
|
69
155
|
return typeof obj === 'object';
|
70
156
|
}
|
71
157
|
const OtS = {}.toString;
|
158
|
+
/**
|
159
|
+
* Converts the argument to a string, safely accounting for objects with "null" prototype.
|
160
|
+
* Note that `toString(null)` returns `"[object Null]"` rather than `"null"`.
|
161
|
+
* @param obj Value to convert to a string.
|
162
|
+
* @returns String representation of the value.
|
163
|
+
*/
|
72
164
|
function toString(obj) {
|
73
|
-
if (obj
|
165
|
+
if (obj?.toString) {
|
74
166
|
// Arrays might hold objects with "null" prototype So using
|
75
167
|
// Array.prototype.toString directly will cause an error Iterate through
|
76
168
|
// all the items and handle individually.
|
77
169
|
if (isArray(obj)) {
|
170
|
+
// This behavior is slightly different from Array#toString:
|
171
|
+
// 1. Array#toString calls `this.join`, rather than Array#join
|
172
|
+
// Ex: arr = []; arr.join = () => 1; arr.toString() === 1; toString(arr) === ''
|
173
|
+
// 2. Array#toString delegates to Object#toString if `this.join` is not a function
|
174
|
+
// Ex: arr = []; arr.join = 'no'; arr.toString() === '[object Array]; toString(arr) = ''
|
175
|
+
// 3. Array#toString converts null/undefined to ''
|
176
|
+
// Ex: arr = [null, undefined]; arr.toString() === ','; toString(arr) === '[object Null],undefined'
|
177
|
+
// 4. Array#toString converts recursive references to arrays to ''
|
178
|
+
// Ex: arr = [1]; arr.push(arr, 2); arr.toString() === '1,,2'; toString(arr) throws
|
179
|
+
// Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString
|
78
180
|
return ArrayJoin.call(ArrayMap.call(obj, toString), ',');
|
79
181
|
}
|
80
182
|
return obj.toString();
|
81
183
|
}
|
82
184
|
else if (typeof obj === 'object') {
|
185
|
+
// This catches null and returns "[object Null]". Weird, but kept for backwards compatibility.
|
83
186
|
return OtS.call(obj);
|
84
187
|
}
|
85
188
|
else {
|
86
|
-
return obj
|
189
|
+
return String(obj);
|
87
190
|
}
|
88
191
|
}
|
89
192
|
|
@@ -105,7 +208,7 @@ const KEY__LEGACY_SHADOW_TOKEN_PRIVATE = '$$LegacyShadowTokenKey$$';
|
|
105
208
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
106
209
|
const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
|
107
210
|
const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
108
|
-
/** version: 6.
|
211
|
+
/** version: 6.2.1 */
|
109
212
|
|
110
213
|
/**
|
111
214
|
* Copyright (c) 2024 Salesforce, Inc.
|
@@ -113,7 +216,7 @@ const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
|
113
216
|
if (!globalThis.lwcRuntimeFlags) {
|
114
217
|
Object.defineProperty(globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
115
218
|
}
|
116
|
-
/** version: 6.
|
219
|
+
/** version: 6.2.1 */
|
117
220
|
|
118
221
|
/*
|
119
222
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -382,6 +485,7 @@ function getNodeKey(node) {
|
|
382
485
|
* This function does not traverse up for performance reasons, but is sufficient for most use
|
383
486
|
* cases. If we need to traverse up and verify those nodes that don't have owner key, use
|
384
487
|
* isNodeDeepShadowed instead.
|
488
|
+
* @param node
|
385
489
|
*/
|
386
490
|
function isNodeShadowed(node) {
|
387
491
|
return !isUndefined(getNodeOwnerKey(node));
|
@@ -438,7 +542,7 @@ function isNodeSlotted(host, node) {
|
|
438
542
|
// have different owner key. for slotted elements, this is possible
|
439
543
|
// if the parent happens to be a slot.
|
440
544
|
if (isSlotElement(parent)) {
|
441
|
-
|
545
|
+
/*
|
442
546
|
* the slot parent might be allocated inside another slot, think of:
|
443
547
|
* <x-root> (<--- root element)
|
444
548
|
* <x-parent> (<--- own by x-root)
|
@@ -912,12 +1016,11 @@ function createStaticNodeList(items) {
|
|
912
1016
|
*/
|
913
1017
|
// Walk up the DOM tree, collecting all shadow roots plus the document root
|
914
1018
|
function getAllRootNodes(node) {
|
915
|
-
var _a;
|
916
1019
|
const rootNodes = [];
|
917
1020
|
let currentRootNode = node.getRootNode();
|
918
1021
|
while (!isUndefined(currentRootNode)) {
|
919
1022
|
rootNodes.push(currentRootNode);
|
920
|
-
currentRootNode =
|
1023
|
+
currentRootNode = currentRootNode.host?.getRootNode();
|
921
1024
|
}
|
922
1025
|
return rootNodes;
|
923
1026
|
}
|
@@ -1063,6 +1166,7 @@ function createStaticHTMLCollection(items) {
|
|
1063
1166
|
* based on the light-dom slotting mechanism. This applies to synthetic slot elements
|
1064
1167
|
* and elements with shadow dom attached to them. It doesn't apply to native slot elements
|
1065
1168
|
* because we don't want to patch the children getters for those elements.
|
1169
|
+
* @param node
|
1066
1170
|
*/
|
1067
1171
|
function hasMountedChildren(node) {
|
1068
1172
|
return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
|
@@ -1185,6 +1289,7 @@ const nativeGetRootNode = _Node.prototype.getRootNode;
|
|
1185
1289
|
const getDocumentOrRootNode = !isUndefined(nativeGetRootNode)
|
1186
1290
|
? nativeGetRootNode
|
1187
1291
|
: function () {
|
1292
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
1188
1293
|
let node = this;
|
1189
1294
|
let nodeParent;
|
1190
1295
|
while (!isNull((nodeParent = parentNodeGetter.call(node)))) {
|
@@ -1196,10 +1301,10 @@ const getDocumentOrRootNode = !isUndefined(nativeGetRootNode)
|
|
1196
1301
|
* Get the shadow root
|
1197
1302
|
* getNodeOwner() returns the host element that owns the given node
|
1198
1303
|
* Note: getNodeOwner() returns null when running in native-shadow mode.
|
1199
|
-
*
|
1200
|
-
*
|
1201
|
-
*
|
1202
|
-
* @param
|
1304
|
+
* Fallback to using the native getRootNode() to discover the root node.
|
1305
|
+
* This is because, it is not possible to inspect the node and decide if it is part
|
1306
|
+
* of a native shadow or the synthetic shadow.
|
1307
|
+
* @param node
|
1203
1308
|
*/
|
1204
1309
|
function getNearestRoot(node) {
|
1205
1310
|
const ownerNode = getNodeOwner(node);
|
@@ -1217,17 +1322,17 @@ function getNearestRoot(node) {
|
|
1217
1322
|
*
|
1218
1323
|
* If looking for a shadow root of a node by calling `node.getRootNode({composed: false})` or `node.getRootNode()`,
|
1219
1324
|
*
|
1220
|
-
*
|
1221
|
-
*
|
1222
|
-
*
|
1223
|
-
*
|
1224
|
-
*
|
1225
|
-
*
|
1226
|
-
*
|
1325
|
+
* 1. Try to identify the host element that owns the give node.
|
1326
|
+
* i. Identify the shadow tree that the node belongs to
|
1327
|
+
* ii. If the node belongs to a shadow tree created by engine, return the shadowRoot of the host element that owns the shadow tree
|
1328
|
+
* 2. The host identification logic returns null in two cases:
|
1329
|
+
* i. The node does not belong to a shadow tree created by engine
|
1330
|
+
* ii. The engine is running in native shadow dom mode
|
1331
|
+
* If so, use the original Node.prototype.getRootNode to fetch the root node(or manually climb up the dom tree where getRootNode() is unsupported)
|
1227
1332
|
*
|
1228
1333
|
* _Spec_: https://dom.spec.whatwg.org/#dom-node-getrootnode
|
1229
|
-
*
|
1230
|
-
|
1334
|
+
* @param options
|
1335
|
+
*/
|
1231
1336
|
function getRootNodePatched(options) {
|
1232
1337
|
const composed = isUndefined(options) ? false : !!options.composed;
|
1233
1338
|
return isTrue(composed) ? getDocumentOrRootNode.call(this, options) : getNearestRoot(this);
|
@@ -1464,7 +1569,7 @@ function getEventHandler(listener) {
|
|
1464
1569
|
}
|
1465
1570
|
}
|
1466
1571
|
function isEventListenerOrEventListenerObject(listener) {
|
1467
|
-
return isFunction(listener) || isFunction(listener
|
1572
|
+
return isFunction(listener) || isFunction(listener?.handleEvent);
|
1468
1573
|
}
|
1469
1574
|
const customElementToWrappedListeners = new WeakMap();
|
1470
1575
|
function getEventMap(elm) {
|
@@ -1479,10 +1584,10 @@ function getEventMap(elm) {
|
|
1479
1584
|
* Events dispatched on shadow roots actually end up being dispatched on their hosts. This means that the event.target
|
1480
1585
|
* property of events dispatched on shadow roots always resolve to their host. This function understands this
|
1481
1586
|
* abstraction and properly returns a reference to the shadow root when appropriate.
|
1587
|
+
* @param event
|
1482
1588
|
*/
|
1483
1589
|
function getActualTarget(event) {
|
1484
|
-
|
1485
|
-
return (_a = eventToShadowRootMap.get(event)) !== null && _a !== void 0 ? _a : eventTargetGetter.call(event);
|
1590
|
+
return eventToShadowRootMap.get(event) ?? eventTargetGetter.call(event);
|
1486
1591
|
}
|
1487
1592
|
const shadowRootEventListenerMap = new WeakMap();
|
1488
1593
|
function getManagedShadowRootListener(listener) {
|
@@ -1619,7 +1724,7 @@ function detachDOMListener(elm, type, managedListener) {
|
|
1619
1724
|
function addCustomElementEventListener(type, listener, _options) {
|
1620
1725
|
if (process.env.NODE_ENV !== 'production') {
|
1621
1726
|
if (!isEventListenerOrEventListenerObject(listener)) {
|
1622
|
-
throw new TypeError(`Invalid second argument for Element.addEventListener() in ${toString(this)} for event "${type}". Expected EventListener or EventListenerObject but received ${listener}.`);
|
1727
|
+
throw new TypeError(`Invalid second argument for Element.addEventListener() in ${toString(this)} for event "${type}". Expected EventListener or EventListenerObject but received ${toString(listener)}.`);
|
1623
1728
|
}
|
1624
1729
|
}
|
1625
1730
|
if (isEventListenerOrEventListenerObject(listener)) {
|
@@ -1636,7 +1741,7 @@ function removeCustomElementEventListener(type, listener, _options) {
|
|
1636
1741
|
function addShadowRootEventListener(sr, type, listener, _options) {
|
1637
1742
|
if (process.env.NODE_ENV !== 'production') {
|
1638
1743
|
if (!isEventListenerOrEventListenerObject(listener)) {
|
1639
|
-
throw new TypeError(`Invalid second argument for ShadowRoot.addEventListener() in ${toString(sr)} for event "${type}". Expected EventListener or EventListenerObject but received ${listener}.`);
|
1744
|
+
throw new TypeError(`Invalid second argument for ShadowRoot.addEventListener() in ${toString(sr)} for event "${type}". Expected EventListener or EventListenerObject but received ${toString(listener)}.`);
|
1640
1745
|
}
|
1641
1746
|
}
|
1642
1747
|
if (isEventListenerOrEventListenerObject(listener)) {
|
@@ -2287,7 +2392,7 @@ function retarget(refNode, path) {
|
|
2287
2392
|
rootIdx = refNodePath.indexOf(root);
|
2288
2393
|
lastRoot = root;
|
2289
2394
|
}
|
2290
|
-
if (!
|
2395
|
+
if (!isUndefined(rootIdx) && rootIdx > -1) {
|
2291
2396
|
return ancestor;
|
2292
2397
|
}
|
2293
2398
|
}
|
@@ -2533,7 +2638,7 @@ function setNodeObservers(node, observers) {
|
|
2533
2638
|
}
|
2534
2639
|
/**
|
2535
2640
|
* Retarget the mutation record's target value to its shadowRoot
|
2536
|
-
* @param
|
2641
|
+
* @param originalRecord
|
2537
2642
|
*/
|
2538
2643
|
function retargetMutationRecord(originalRecord) {
|
2539
2644
|
const { addedNodes, removedNodes, target, type } = originalRecord;
|
@@ -2573,8 +2678,8 @@ function retargetMutationRecord(originalRecord) {
|
|
2573
2678
|
/**
|
2574
2679
|
* Utility to identify if a target node is being observed by the given observer
|
2575
2680
|
* Start at the current node, if the observer is registered to observe the current node, the mutation qualifies
|
2576
|
-
* @param
|
2577
|
-
* @param
|
2681
|
+
* @param observer
|
2682
|
+
* @param target
|
2578
2683
|
*/
|
2579
2684
|
function isQualifiedObserver(observer, target) {
|
2580
2685
|
let parentNode = target;
|
@@ -2595,8 +2700,8 @@ function isQualifiedObserver(observer, target) {
|
|
2595
2700
|
* The key logic here is to determine if a given observer has been registered to observe any nodes
|
2596
2701
|
* between the target node of a mutation record to the target's root node.
|
2597
2702
|
* This function also retargets records when mutations occur directly under the shadow root
|
2598
|
-
* @param
|
2599
|
-
* @param
|
2703
|
+
* @param mutations
|
2704
|
+
* @param observer
|
2600
2705
|
*/
|
2601
2706
|
function filterMutationRecords(mutations, observer) {
|
2602
2707
|
const result = [];
|
@@ -2678,7 +2783,7 @@ function getWrappedCallback(callback) {
|
|
2678
2783
|
* Patched MutationObserver constructor.
|
2679
2784
|
* 1. Wrap the callback to filter out MutationRecords based on dom ownership
|
2680
2785
|
* 2. Add a property field to track all observed targets of the observer instance
|
2681
|
-
* @param
|
2786
|
+
* @param callback
|
2682
2787
|
*/
|
2683
2788
|
function PatchedMutationObserver(callback) {
|
2684
2789
|
const wrappedCallback = getWrappedCallback(callback);
|
@@ -2705,8 +2810,8 @@ function patchedDisconnect() {
|
|
2705
2810
|
/**
|
2706
2811
|
* A single mutation observer can observe multiple nodes(target).
|
2707
2812
|
* Maintain a list of all targets that the observer chooses to observe
|
2708
|
-
* @param
|
2709
|
-
* @param
|
2813
|
+
* @param target
|
2814
|
+
* @param options
|
2710
2815
|
*/
|
2711
2816
|
function patchedObserve(target, options) {
|
2712
2817
|
let targetObservers = getNodeObservers(target);
|
@@ -3044,9 +3149,8 @@ function assignedSlotGetterPatched() {
|
|
3044
3149
|
}
|
3045
3150
|
/**
|
3046
3151
|
* The node is assigned to a slot if:
|
3047
|
-
*
|
3048
|
-
*
|
3049
|
-
*
|
3152
|
+
* - it has a parent and its parent is a slot element
|
3153
|
+
* - and if the slot owner key is different than the node owner key.
|
3050
3154
|
* When the slot and the slotted node are 2 different shadow trees, the owner keys will be
|
3051
3155
|
* different. When the slot is in a shadow tree and the slotted content is a light DOM node,
|
3052
3156
|
* the light DOM node doesn't have an owner key and therefor the slot owner key will be
|
@@ -3161,6 +3265,8 @@ defineProperties(Text.prototype, {
|
|
3161
3265
|
/**
|
3162
3266
|
* This methods filters out elements that are not in the same shadow root of context.
|
3163
3267
|
* It does not enforce shadow dom semantics if $context is not managed by LWC
|
3268
|
+
* @param context
|
3269
|
+
* @param unfilteredNodes
|
3164
3270
|
*/
|
3165
3271
|
function getNonPatchedFilteredArrayOfNodes(context, unfilteredNodes) {
|
3166
3272
|
let filtered;
|
@@ -3869,6 +3975,7 @@ function tabIndexGetterPatched() {
|
|
3869
3975
|
}
|
3870
3976
|
/**
|
3871
3977
|
* This method only applies to elements with a shadow attached to them
|
3978
|
+
* @param value
|
3872
3979
|
*/
|
3873
3980
|
function tabIndexSetterPatched(value) {
|
3874
3981
|
// This tabIndex setter might be confusing unless it is understood that HTML
|
@@ -4049,13 +4156,10 @@ function setShadowToken(node, shadowToken) {
|
|
4049
4156
|
}
|
4050
4157
|
/**
|
4051
4158
|
* Patching Element.prototype.$shadowToken$ to mark elements a portal:
|
4052
|
-
*
|
4053
|
-
*
|
4054
|
-
*
|
4055
|
-
|
4056
|
-
* - this custom attribute must be unique.
|
4057
|
-
*
|
4058
|
-
**/
|
4159
|
+
* - we use a property to allow engines to set a custom attribute that should be
|
4160
|
+
* placed into the element to sandbox the css rules defined for the template.
|
4161
|
+
* - this custom attribute must be unique.
|
4162
|
+
*/
|
4059
4163
|
defineProperty(Element.prototype, KEY__SHADOW_TOKEN, {
|
4060
4164
|
set(shadowToken) {
|
4061
4165
|
const oldShadowToken = this[KEY__SHADOW_TOKEN_PRIVATE];
|
@@ -4110,7 +4214,7 @@ function setLegacyShadowToken(node, shadowToken) {
|
|
4110
4214
|
/**
|
4111
4215
|
* Patching Element.prototype.$legacyShadowToken$ to mark elements a portal:
|
4112
4216
|
* Same as $shadowToken$ but for legacy CSS scope tokens.
|
4113
|
-
|
4217
|
+
*/
|
4114
4218
|
defineProperty(Element.prototype, KEY__LEGACY_SHADOW_TOKEN, {
|
4115
4219
|
set(shadowToken) {
|
4116
4220
|
const oldShadowToken = this[KEY__LEGACY_SHADOW_TOKEN_PRIVATE];
|
@@ -4224,18 +4328,14 @@ function markElementAsPortal(elm) {
|
|
4224
4328
|
}
|
4225
4329
|
/**
|
4226
4330
|
* Patching Element.prototype.$domManual$ to mark elements as portal:
|
4227
|
-
*
|
4228
|
-
*
|
4229
|
-
*
|
4230
|
-
*
|
4231
|
-
*
|
4232
|
-
*
|
4233
|
-
*
|
4234
|
-
|
4235
|
-
* - at the moment, there is no way to undo this operation, once the element is
|
4236
|
-
* marked as $domManual$, setting it to false does nothing.
|
4237
|
-
*
|
4238
|
-
**/
|
4331
|
+
* - we use a property to allow engines to signal that a particular element in
|
4332
|
+
* a shadow supports manual insertion of child nodes.
|
4333
|
+
* - this signal comes as a boolean value, and we use it to install the MO instance
|
4334
|
+
* onto the element, to propagate the $ownerKey$ and $shadowToken$ to all new
|
4335
|
+
* child nodes.
|
4336
|
+
* - at the moment, there is no way to undo this operation, once the element is
|
4337
|
+
* marked as $domManual$, setting it to false does nothing.
|
4338
|
+
*/
|
4239
4339
|
// TODO [#1306]: rename this to $observerConnection$
|
4240
4340
|
defineProperty(Element.prototype, '$domManual$', {
|
4241
4341
|
set(v) {
|
@@ -4249,6 +4349,6 @@ defineProperty(Element.prototype, '$domManual$', {
|
|
4249
4349
|
},
|
4250
4350
|
configurable: true,
|
4251
4351
|
});
|
4252
|
-
/** version: 6.
|
4352
|
+
/** version: 6.2.1 */
|
4253
4353
|
}
|
4254
4354
|
//# sourceMappingURL=index.js.map
|