@lwc/synthetic-shadow 6.2.0 → 6.2.1
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/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 +153 -54
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +153 -54
- 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
@@ -8,6 +8,7 @@ export declare const eventToContextMap: WeakMap<Event, EventListenerContext>;
|
|
8
8
|
* Events dispatched on shadow roots actually end up being dispatched on their hosts. This means that the event.target
|
9
9
|
* property of events dispatched on shadow roots always resolve to their host. This function understands this
|
10
10
|
* abstraction and properly returns a reference to the shadow root when appropriate.
|
11
|
+
* @param event
|
11
12
|
*/
|
12
13
|
export declare function getActualTarget(event: Event): EventTarget;
|
13
14
|
export declare function addCustomElementEventListener(this: Element, type: string, listener: unknown, _options?: boolean | AddEventListenerOptions): void;
|
@@ -1,5 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* This methods filters out elements that are not in the same shadow root of context.
|
3
3
|
* It does not enforce shadow dom semantics if $context is not managed by LWC
|
4
|
+
* @param context
|
5
|
+
* @param unfilteredNodes
|
4
6
|
*/
|
5
7
|
export declare function getNonPatchedFilteredArrayOfNodes<T extends Node>(context: Element, unfilteredNodes: Array<T>): Array<T>;
|
@@ -3,6 +3,7 @@
|
|
3
3
|
* based on the light-dom slotting mechanism. This applies to synthetic slot elements
|
4
4
|
* and elements with shadow dom attached to them. It doesn't apply to native slot elements
|
5
5
|
* because we don't want to patch the children getters for those elements.
|
6
|
+
* @param node
|
6
7
|
*/
|
7
8
|
export declare function hasMountedChildren(node: Node): boolean;
|
8
9
|
export declare const getInternalChildNodes: (node: Node) => NodeListOf<ChildNode>;
|
package/dist/index.cjs.js
CHANGED
@@ -16,21 +16,40 @@ if (!lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
|
|
16
16
|
* SPDX-License-Identifier: MIT
|
17
17
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
18
18
|
*/
|
19
|
+
/**
|
20
|
+
*
|
21
|
+
* @param value
|
22
|
+
* @param msg
|
23
|
+
*/
|
19
24
|
function invariant(value, msg) {
|
20
25
|
if (!value) {
|
21
26
|
throw new Error(`Invariant Violation: ${msg}`);
|
22
27
|
}
|
23
28
|
}
|
29
|
+
/**
|
30
|
+
*
|
31
|
+
* @param value
|
32
|
+
* @param msg
|
33
|
+
*/
|
24
34
|
function isTrue$1(value, msg) {
|
25
35
|
if (!value) {
|
26
36
|
throw new Error(`Assert Violation: ${msg}`);
|
27
37
|
}
|
28
38
|
}
|
39
|
+
/**
|
40
|
+
*
|
41
|
+
* @param value
|
42
|
+
* @param msg
|
43
|
+
*/
|
29
44
|
function isFalse$1(value, msg) {
|
30
45
|
if (value) {
|
31
46
|
throw new Error(`Assert Violation: ${msg}`);
|
32
47
|
}
|
33
48
|
}
|
49
|
+
/**
|
50
|
+
*
|
51
|
+
* @param msg
|
52
|
+
*/
|
34
53
|
function fail(msg) {
|
35
54
|
throw new Error(msg);
|
36
55
|
}
|
@@ -44,50 +63,132 @@ var assert = /*#__PURE__*/Object.freeze({
|
|
44
63
|
});
|
45
64
|
|
46
65
|
/*
|
47
|
-
* Copyright (c)
|
66
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
48
67
|
* All rights reserved.
|
49
68
|
* SPDX-License-Identifier: MIT
|
50
69
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
51
70
|
*/
|
52
|
-
const {
|
71
|
+
const {
|
72
|
+
/** Detached {@linkcode Object.assign}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign MDN Reference}. */
|
73
|
+
assign,
|
74
|
+
/** Detached {@linkcode Object.create}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create MDN Reference}. */
|
75
|
+
create,
|
76
|
+
/** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */
|
77
|
+
defineProperties,
|
78
|
+
/** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */
|
79
|
+
defineProperty,
|
80
|
+
/** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
|
81
|
+
entries,
|
82
|
+
/** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */
|
83
|
+
freeze,
|
84
|
+
/** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */
|
85
|
+
getOwnPropertyDescriptor,
|
86
|
+
/** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */
|
87
|
+
getOwnPropertyDescriptors,
|
88
|
+
/** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
|
89
|
+
getOwnPropertyNames,
|
90
|
+
/** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */
|
91
|
+
getPrototypeOf,
|
92
|
+
/** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */
|
93
|
+
hasOwnProperty,
|
94
|
+
/** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */
|
95
|
+
isFrozen,
|
96
|
+
/** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */
|
97
|
+
keys,
|
98
|
+
/** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */
|
99
|
+
seal,
|
100
|
+
/** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */
|
101
|
+
setPrototypeOf, } = Object;
|
102
|
+
/** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
|
53
103
|
const { isArray } = Array;
|
54
|
-
|
104
|
+
// For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
|
105
|
+
// though it works fine for one, e.g. isArray), so comments for these are added to the export
|
106
|
+
// statement, rather than this declaration.
|
107
|
+
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!
|
108
|
+
} = Array.prototype;
|
109
|
+
/**
|
110
|
+
* Determines whether the argument is `undefined`.
|
111
|
+
* @param obj Value to test
|
112
|
+
* @returns `true` if the value is `undefined`.
|
113
|
+
*/
|
55
114
|
function isUndefined(obj) {
|
56
115
|
return obj === undefined;
|
57
116
|
}
|
117
|
+
/**
|
118
|
+
* Determines whether the argument is `null`.
|
119
|
+
* @param obj Value to test
|
120
|
+
* @returns `true` if the value is `null`.
|
121
|
+
*/
|
58
122
|
function isNull(obj) {
|
59
123
|
return obj === null;
|
60
124
|
}
|
125
|
+
/**
|
126
|
+
* Determines whether the argument is `true`.
|
127
|
+
* @param obj Value to test
|
128
|
+
* @returns `true` if the value is `true`.
|
129
|
+
*/
|
61
130
|
function isTrue(obj) {
|
62
131
|
return obj === true;
|
63
132
|
}
|
133
|
+
/**
|
134
|
+
* Determines whether the argument is `false`.
|
135
|
+
* @param obj Value to test
|
136
|
+
* @returns `true` if the value is `false`.
|
137
|
+
*/
|
64
138
|
function isFalse(obj) {
|
65
139
|
return obj === false;
|
66
140
|
}
|
141
|
+
/**
|
142
|
+
* Determines whether the argument is a function.
|
143
|
+
* @param obj Value to test
|
144
|
+
* @returns `true` if the value is a function.
|
145
|
+
*/
|
67
146
|
// Replacing `Function` with a narrower type that works for all our use cases is tricky...
|
68
147
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
69
148
|
function isFunction(obj) {
|
70
149
|
return typeof obj === 'function';
|
71
150
|
}
|
151
|
+
/**
|
152
|
+
* Determines whether the argument is an object or null.
|
153
|
+
* @param obj Value to test
|
154
|
+
* @returns `true` if the value is an object or null.
|
155
|
+
*/
|
72
156
|
function isObject(obj) {
|
73
157
|
return typeof obj === 'object';
|
74
158
|
}
|
75
159
|
const OtS = {}.toString;
|
160
|
+
/**
|
161
|
+
* Converts the argument to a string, safely accounting for objects with "null" prototype.
|
162
|
+
* Note that `toString(null)` returns `"[object Null]"` rather than `"null"`.
|
163
|
+
* @param obj Value to convert to a string.
|
164
|
+
* @returns String representation of the value.
|
165
|
+
*/
|
76
166
|
function toString(obj) {
|
77
|
-
if (obj
|
167
|
+
if (obj?.toString) {
|
78
168
|
// Arrays might hold objects with "null" prototype So using
|
79
169
|
// Array.prototype.toString directly will cause an error Iterate through
|
80
170
|
// all the items and handle individually.
|
81
171
|
if (isArray(obj)) {
|
172
|
+
// This behavior is slightly different from Array#toString:
|
173
|
+
// 1. Array#toString calls `this.join`, rather than Array#join
|
174
|
+
// Ex: arr = []; arr.join = () => 1; arr.toString() === 1; toString(arr) === ''
|
175
|
+
// 2. Array#toString delegates to Object#toString if `this.join` is not a function
|
176
|
+
// Ex: arr = []; arr.join = 'no'; arr.toString() === '[object Array]; toString(arr) = ''
|
177
|
+
// 3. Array#toString converts null/undefined to ''
|
178
|
+
// Ex: arr = [null, undefined]; arr.toString() === ','; toString(arr) === '[object Null],undefined'
|
179
|
+
// 4. Array#toString converts recursive references to arrays to ''
|
180
|
+
// Ex: arr = [1]; arr.push(arr, 2); arr.toString() === '1,,2'; toString(arr) throws
|
181
|
+
// Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString
|
82
182
|
return ArrayJoin.call(ArrayMap.call(obj, toString), ',');
|
83
183
|
}
|
84
184
|
return obj.toString();
|
85
185
|
}
|
86
186
|
else if (typeof obj === 'object') {
|
187
|
+
// This catches null and returns "[object Null]". Weird, but kept for backwards compatibility.
|
87
188
|
return OtS.call(obj);
|
88
189
|
}
|
89
190
|
else {
|
90
|
-
return obj
|
191
|
+
return String(obj);
|
91
192
|
}
|
92
193
|
}
|
93
194
|
|
@@ -109,7 +210,7 @@ const KEY__LEGACY_SHADOW_TOKEN_PRIVATE = '$$LegacyShadowTokenKey$$';
|
|
109
210
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
110
211
|
const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
|
111
212
|
const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
112
|
-
/** version: 6.2.
|
213
|
+
/** version: 6.2.1 */
|
113
214
|
|
114
215
|
/**
|
115
216
|
* Copyright (c) 2024 Salesforce, Inc.
|
@@ -117,7 +218,7 @@ const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
|
117
218
|
if (!globalThis.lwcRuntimeFlags) {
|
118
219
|
Object.defineProperty(globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
119
220
|
}
|
120
|
-
/** version: 6.2.
|
221
|
+
/** version: 6.2.1 */
|
121
222
|
|
122
223
|
/*
|
123
224
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -386,6 +487,7 @@ function getNodeKey(node) {
|
|
386
487
|
* This function does not traverse up for performance reasons, but is sufficient for most use
|
387
488
|
* cases. If we need to traverse up and verify those nodes that don't have owner key, use
|
388
489
|
* isNodeDeepShadowed instead.
|
490
|
+
* @param node
|
389
491
|
*/
|
390
492
|
function isNodeShadowed(node) {
|
391
493
|
return !isUndefined(getNodeOwnerKey(node));
|
@@ -442,7 +544,7 @@ function isNodeSlotted(host, node) {
|
|
442
544
|
// have different owner key. for slotted elements, this is possible
|
443
545
|
// if the parent happens to be a slot.
|
444
546
|
if (isSlotElement(parent)) {
|
445
|
-
|
547
|
+
/*
|
446
548
|
* the slot parent might be allocated inside another slot, think of:
|
447
549
|
* <x-root> (<--- root element)
|
448
550
|
* <x-parent> (<--- own by x-root)
|
@@ -1066,6 +1168,7 @@ function createStaticHTMLCollection(items) {
|
|
1066
1168
|
* based on the light-dom slotting mechanism. This applies to synthetic slot elements
|
1067
1169
|
* and elements with shadow dom attached to them. It doesn't apply to native slot elements
|
1068
1170
|
* because we don't want to patch the children getters for those elements.
|
1171
|
+
* @param node
|
1069
1172
|
*/
|
1070
1173
|
function hasMountedChildren(node) {
|
1071
1174
|
return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
|
@@ -1200,10 +1303,10 @@ const getDocumentOrRootNode = !isUndefined(nativeGetRootNode)
|
|
1200
1303
|
* Get the shadow root
|
1201
1304
|
* getNodeOwner() returns the host element that owns the given node
|
1202
1305
|
* Note: getNodeOwner() returns null when running in native-shadow mode.
|
1203
|
-
*
|
1204
|
-
*
|
1205
|
-
*
|
1206
|
-
* @param
|
1306
|
+
* Fallback to using the native getRootNode() to discover the root node.
|
1307
|
+
* This is because, it is not possible to inspect the node and decide if it is part
|
1308
|
+
* of a native shadow or the synthetic shadow.
|
1309
|
+
* @param node
|
1207
1310
|
*/
|
1208
1311
|
function getNearestRoot(node) {
|
1209
1312
|
const ownerNode = getNodeOwner(node);
|
@@ -1221,17 +1324,17 @@ function getNearestRoot(node) {
|
|
1221
1324
|
*
|
1222
1325
|
* If looking for a shadow root of a node by calling `node.getRootNode({composed: false})` or `node.getRootNode()`,
|
1223
1326
|
*
|
1224
|
-
*
|
1225
|
-
*
|
1226
|
-
*
|
1227
|
-
*
|
1228
|
-
*
|
1229
|
-
*
|
1230
|
-
*
|
1327
|
+
* 1. Try to identify the host element that owns the give node.
|
1328
|
+
* i. Identify the shadow tree that the node belongs to
|
1329
|
+
* ii. If the node belongs to a shadow tree created by engine, return the shadowRoot of the host element that owns the shadow tree
|
1330
|
+
* 2. The host identification logic returns null in two cases:
|
1331
|
+
* i. The node does not belong to a shadow tree created by engine
|
1332
|
+
* ii. The engine is running in native shadow dom mode
|
1333
|
+
* If so, use the original Node.prototype.getRootNode to fetch the root node(or manually climb up the dom tree where getRootNode() is unsupported)
|
1231
1334
|
*
|
1232
1335
|
* _Spec_: https://dom.spec.whatwg.org/#dom-node-getrootnode
|
1233
|
-
*
|
1234
|
-
|
1336
|
+
* @param options
|
1337
|
+
*/
|
1235
1338
|
function getRootNodePatched(options) {
|
1236
1339
|
const composed = isUndefined(options) ? false : !!options.composed;
|
1237
1340
|
return isTrue(composed) ? getDocumentOrRootNode.call(this, options) : getNearestRoot(this);
|
@@ -1483,6 +1586,7 @@ function getEventMap(elm) {
|
|
1483
1586
|
* Events dispatched on shadow roots actually end up being dispatched on their hosts. This means that the event.target
|
1484
1587
|
* property of events dispatched on shadow roots always resolve to their host. This function understands this
|
1485
1588
|
* abstraction and properly returns a reference to the shadow root when appropriate.
|
1589
|
+
* @param event
|
1486
1590
|
*/
|
1487
1591
|
function getActualTarget(event) {
|
1488
1592
|
return eventToShadowRootMap.get(event) ?? eventTargetGetter.call(event);
|
@@ -2290,7 +2394,7 @@ function retarget(refNode, path) {
|
|
2290
2394
|
rootIdx = refNodePath.indexOf(root);
|
2291
2395
|
lastRoot = root;
|
2292
2396
|
}
|
2293
|
-
if (!
|
2397
|
+
if (!isUndefined(rootIdx) && rootIdx > -1) {
|
2294
2398
|
return ancestor;
|
2295
2399
|
}
|
2296
2400
|
}
|
@@ -2536,7 +2640,7 @@ function setNodeObservers(node, observers) {
|
|
2536
2640
|
}
|
2537
2641
|
/**
|
2538
2642
|
* Retarget the mutation record's target value to its shadowRoot
|
2539
|
-
* @param
|
2643
|
+
* @param originalRecord
|
2540
2644
|
*/
|
2541
2645
|
function retargetMutationRecord(originalRecord) {
|
2542
2646
|
const { addedNodes, removedNodes, target, type } = originalRecord;
|
@@ -2576,8 +2680,8 @@ function retargetMutationRecord(originalRecord) {
|
|
2576
2680
|
/**
|
2577
2681
|
* Utility to identify if a target node is being observed by the given observer
|
2578
2682
|
* Start at the current node, if the observer is registered to observe the current node, the mutation qualifies
|
2579
|
-
* @param
|
2580
|
-
* @param
|
2683
|
+
* @param observer
|
2684
|
+
* @param target
|
2581
2685
|
*/
|
2582
2686
|
function isQualifiedObserver(observer, target) {
|
2583
2687
|
let parentNode = target;
|
@@ -2598,8 +2702,8 @@ function isQualifiedObserver(observer, target) {
|
|
2598
2702
|
* The key logic here is to determine if a given observer has been registered to observe any nodes
|
2599
2703
|
* between the target node of a mutation record to the target's root node.
|
2600
2704
|
* This function also retargets records when mutations occur directly under the shadow root
|
2601
|
-
* @param
|
2602
|
-
* @param
|
2705
|
+
* @param mutations
|
2706
|
+
* @param observer
|
2603
2707
|
*/
|
2604
2708
|
function filterMutationRecords(mutations, observer) {
|
2605
2709
|
const result = [];
|
@@ -2681,7 +2785,7 @@ function getWrappedCallback(callback) {
|
|
2681
2785
|
* Patched MutationObserver constructor.
|
2682
2786
|
* 1. Wrap the callback to filter out MutationRecords based on dom ownership
|
2683
2787
|
* 2. Add a property field to track all observed targets of the observer instance
|
2684
|
-
* @param
|
2788
|
+
* @param callback
|
2685
2789
|
*/
|
2686
2790
|
function PatchedMutationObserver(callback) {
|
2687
2791
|
const wrappedCallback = getWrappedCallback(callback);
|
@@ -2708,8 +2812,8 @@ function patchedDisconnect() {
|
|
2708
2812
|
/**
|
2709
2813
|
* A single mutation observer can observe multiple nodes(target).
|
2710
2814
|
* Maintain a list of all targets that the observer chooses to observe
|
2711
|
-
* @param
|
2712
|
-
* @param
|
2815
|
+
* @param target
|
2816
|
+
* @param options
|
2713
2817
|
*/
|
2714
2818
|
function patchedObserve(target, options) {
|
2715
2819
|
let targetObservers = getNodeObservers(target);
|
@@ -3047,9 +3151,8 @@ function assignedSlotGetterPatched() {
|
|
3047
3151
|
}
|
3048
3152
|
/**
|
3049
3153
|
* The node is assigned to a slot if:
|
3050
|
-
*
|
3051
|
-
*
|
3052
|
-
*
|
3154
|
+
* - it has a parent and its parent is a slot element
|
3155
|
+
* - and if the slot owner key is different than the node owner key.
|
3053
3156
|
* When the slot and the slotted node are 2 different shadow trees, the owner keys will be
|
3054
3157
|
* different. When the slot is in a shadow tree and the slotted content is a light DOM node,
|
3055
3158
|
* the light DOM node doesn't have an owner key and therefor the slot owner key will be
|
@@ -3164,6 +3267,8 @@ defineProperties(Text.prototype, {
|
|
3164
3267
|
/**
|
3165
3268
|
* This methods filters out elements that are not in the same shadow root of context.
|
3166
3269
|
* It does not enforce shadow dom semantics if $context is not managed by LWC
|
3270
|
+
* @param context
|
3271
|
+
* @param unfilteredNodes
|
3167
3272
|
*/
|
3168
3273
|
function getNonPatchedFilteredArrayOfNodes(context, unfilteredNodes) {
|
3169
3274
|
let filtered;
|
@@ -3872,6 +3977,7 @@ function tabIndexGetterPatched() {
|
|
3872
3977
|
}
|
3873
3978
|
/**
|
3874
3979
|
* This method only applies to elements with a shadow attached to them
|
3980
|
+
* @param value
|
3875
3981
|
*/
|
3876
3982
|
function tabIndexSetterPatched(value) {
|
3877
3983
|
// This tabIndex setter might be confusing unless it is understood that HTML
|
@@ -4052,13 +4158,10 @@ function setShadowToken(node, shadowToken) {
|
|
4052
4158
|
}
|
4053
4159
|
/**
|
4054
4160
|
* Patching Element.prototype.$shadowToken$ to mark elements a portal:
|
4055
|
-
*
|
4056
|
-
*
|
4057
|
-
*
|
4058
|
-
|
4059
|
-
* - this custom attribute must be unique.
|
4060
|
-
*
|
4061
|
-
**/
|
4161
|
+
* - we use a property to allow engines to set a custom attribute that should be
|
4162
|
+
* placed into the element to sandbox the css rules defined for the template.
|
4163
|
+
* - this custom attribute must be unique.
|
4164
|
+
*/
|
4062
4165
|
defineProperty(Element.prototype, KEY__SHADOW_TOKEN, {
|
4063
4166
|
set(shadowToken) {
|
4064
4167
|
const oldShadowToken = this[KEY__SHADOW_TOKEN_PRIVATE];
|
@@ -4113,7 +4216,7 @@ function setLegacyShadowToken(node, shadowToken) {
|
|
4113
4216
|
/**
|
4114
4217
|
* Patching Element.prototype.$legacyShadowToken$ to mark elements a portal:
|
4115
4218
|
* Same as $shadowToken$ but for legacy CSS scope tokens.
|
4116
|
-
|
4219
|
+
*/
|
4117
4220
|
defineProperty(Element.prototype, KEY__LEGACY_SHADOW_TOKEN, {
|
4118
4221
|
set(shadowToken) {
|
4119
4222
|
const oldShadowToken = this[KEY__LEGACY_SHADOW_TOKEN_PRIVATE];
|
@@ -4227,18 +4330,14 @@ function markElementAsPortal(elm) {
|
|
4227
4330
|
}
|
4228
4331
|
/**
|
4229
4332
|
* Patching Element.prototype.$domManual$ to mark elements as portal:
|
4230
|
-
*
|
4231
|
-
*
|
4232
|
-
*
|
4233
|
-
*
|
4234
|
-
*
|
4235
|
-
*
|
4236
|
-
*
|
4237
|
-
|
4238
|
-
* - at the moment, there is no way to undo this operation, once the element is
|
4239
|
-
* marked as $domManual$, setting it to false does nothing.
|
4240
|
-
*
|
4241
|
-
**/
|
4333
|
+
* - we use a property to allow engines to signal that a particular element in
|
4334
|
+
* a shadow supports manual insertion of child nodes.
|
4335
|
+
* - this signal comes as a boolean value, and we use it to install the MO instance
|
4336
|
+
* onto the element, to propagate the $ownerKey$ and $shadowToken$ to all new
|
4337
|
+
* child nodes.
|
4338
|
+
* - at the moment, there is no way to undo this operation, once the element is
|
4339
|
+
* marked as $domManual$, setting it to false does nothing.
|
4340
|
+
*/
|
4242
4341
|
// TODO [#1306]: rename this to $observerConnection$
|
4243
4342
|
defineProperty(Element.prototype, '$domManual$', {
|
4244
4343
|
set(v) {
|
@@ -4252,6 +4351,6 @@ defineProperty(Element.prototype, '$domManual$', {
|
|
4252
4351
|
},
|
4253
4352
|
configurable: true,
|
4254
4353
|
});
|
4255
|
-
/** version: 6.2.
|
4354
|
+
/** version: 6.2.1 */
|
4256
4355
|
}
|
4257
4356
|
//# sourceMappingURL=index.cjs.js.map
|