@lwc/synthetic-shadow 2.7.1 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/synthetic-shadow.js +41 -6
- package/package.json +4 -4
- package/LICENSE +0 -10
package/dist/synthetic-shadow.js
CHANGED
@@ -194,7 +194,7 @@ const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
194
194
|
|
195
195
|
|
196
196
|
const hasNativeSymbolSupport = /*@__PURE__*/(() => Symbol('x').toString() === 'Symbol(x)')();
|
197
|
-
/** version: 2.
|
197
|
+
/** version: 2.8.0 */
|
198
198
|
|
199
199
|
/*
|
200
200
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -1524,7 +1524,7 @@ if (!_globalThis.lwcRuntimeFlags) {
|
|
1524
1524
|
}
|
1525
1525
|
|
1526
1526
|
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
1527
|
-
/** version: 2.
|
1527
|
+
/** version: 2.8.0 */
|
1528
1528
|
|
1529
1529
|
/*
|
1530
1530
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -2010,7 +2010,22 @@ function getAllRootNodes(node) {
|
|
2010
2010
|
}
|
2011
2011
|
|
2012
2012
|
return rootNodes;
|
2013
|
-
}
|
2013
|
+
} // Keep searching up the host tree until we find an element that is within the immediate shadow root
|
2014
|
+
|
2015
|
+
|
2016
|
+
const findAncestorHostInImmediateShadowRoot = (rootNode, targetRootNode) => {
|
2017
|
+
let host;
|
2018
|
+
|
2019
|
+
while (!isUndefined(host = rootNode.host)) {
|
2020
|
+
const thisRootNode = host.getRootNode();
|
2021
|
+
|
2022
|
+
if (thisRootNode === targetRootNode) {
|
2023
|
+
return host;
|
2024
|
+
}
|
2025
|
+
|
2026
|
+
rootNode = thisRootNode;
|
2027
|
+
}
|
2028
|
+
};
|
2014
2029
|
|
2015
2030
|
function fauxElementsFromPoint(context, doc, left, top) {
|
2016
2031
|
const elements = elementsFromPoint.call(doc, left, top);
|
@@ -2024,8 +2039,28 @@ function fauxElementsFromPoint(context, doc, left, top) {
|
|
2024
2039
|
for (let i = 0; i < elements.length; i++) {
|
2025
2040
|
const element = elements[i];
|
2026
2041
|
|
2027
|
-
if (
|
2028
|
-
|
2042
|
+
if (isSyntheticSlotElement(element)) {
|
2043
|
+
continue;
|
2044
|
+
}
|
2045
|
+
|
2046
|
+
const elementRootNode = element.getRootNode();
|
2047
|
+
|
2048
|
+
if (ArrayIndexOf.call(rootNodes, elementRootNode) !== -1) {
|
2049
|
+
ArrayPush.call(result, element);
|
2050
|
+
continue;
|
2051
|
+
} // In cases where the host element is not visible but its shadow descendants are, then
|
2052
|
+
// we may get the shadow descendant instead of the host element here. (The
|
2053
|
+
// browser doesn't know the difference in synthetic shadow DOM.)
|
2054
|
+
// In native shadow DOM, however, elementsFromPoint would return the host but not
|
2055
|
+
// the child. So we need to detect if this shadow element's host is accessible from
|
2056
|
+
// the context's shadow root. Note we also need to be careful not to add the host
|
2057
|
+
// multiple times.
|
2058
|
+
|
2059
|
+
|
2060
|
+
const ancestorHost = findAncestorHostInImmediateShadowRoot(elementRootNode, rootNodes[0]);
|
2061
|
+
|
2062
|
+
if (!isUndefined(ancestorHost) && ArrayIndexOf.call(elements, ancestorHost) === -1 && ArrayIndexOf.call(result, ancestorHost) === -1) {
|
2063
|
+
ArrayPush.call(result, ancestorHost);
|
2029
2064
|
}
|
2030
2065
|
}
|
2031
2066
|
}
|
@@ -5680,4 +5715,4 @@ defineProperty(Element.prototype, '$domManual$', {
|
|
5680
5715
|
|
5681
5716
|
configurable: true
|
5682
5717
|
});
|
5683
|
-
/** version: 2.
|
5718
|
+
/** version: 2.8.0 */
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lwc/synthetic-shadow",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.8.0",
|
4
4
|
"description": "Synthetic Shadow Root for LWC",
|
5
5
|
"homepage": "https://lwc.dev/",
|
6
6
|
"repository": {
|
@@ -36,8 +36,8 @@
|
|
36
36
|
"access": "public"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@lwc/features": "2.
|
40
|
-
"@lwc/shared": "2.
|
39
|
+
"@lwc/features": "2.8.0",
|
40
|
+
"@lwc/shared": "2.8.0"
|
41
41
|
},
|
42
|
-
"gitHead": "
|
42
|
+
"gitHead": "94040389ab8fc717b8753e503f659489480a327d"
|
43
43
|
}
|
package/LICENSE
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
MIT LICENSE
|
2
|
-
|
3
|
-
Copyright (c) 2018, Salesforce.com, Inc.
|
4
|
-
All rights reserved.
|
5
|
-
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
|
-
|
8
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
9
|
-
|
10
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|