lwc 2.32.0 → 2.33.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 +898 -802
- package/dist/engine-dom/iife/es2017/engine-dom.js +898 -802
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +683 -608
- package/dist/engine-dom/iife/es5/engine-dom.js +324 -313
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +234 -270
- package/dist/engine-dom/umd/es2017/engine-dom.js +898 -802
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +683 -608
- package/dist/engine-dom/umd/es5/engine-dom.js +324 -313
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +234 -270
- package/dist/engine-server/commonjs/es2017/engine-server.js +871 -696
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +871 -696
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +676 -909
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +676 -909
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +644 -882
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +89 -347
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +89 -347
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +676 -909
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +644 -882
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +89 -347
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +89 -347
- 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_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +5 -3
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +5 -3
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +5 -3
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +5 -3
- package/package.json +7 -7
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var _create, _create2;
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
7
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
11
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
10
12
|
|
|
@@ -108,7 +110,7 @@
|
|
|
108
110
|
var KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
109
111
|
var KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
|
|
110
112
|
var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
111
|
-
/** version: 2.
|
|
113
|
+
/** version: 2.33.0 */
|
|
112
114
|
|
|
113
115
|
/*
|
|
114
116
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -270,9 +272,7 @@
|
|
|
270
272
|
*/
|
|
271
273
|
var _window = window,
|
|
272
274
|
windowAddEventListener = _window.addEventListener,
|
|
273
|
-
windowRemoveEventListener = _window.removeEventListener
|
|
274
|
-
windowGetComputedStyle = _window.getComputedStyle,
|
|
275
|
-
windowGetSelection = _window.getSelection;
|
|
275
|
+
windowRemoveEventListener = _window.removeEventListener;
|
|
276
276
|
|
|
277
277
|
/*
|
|
278
278
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -382,7 +382,8 @@
|
|
|
382
382
|
return win;
|
|
383
383
|
}
|
|
384
384
|
var skipGlobalPatching;
|
|
385
|
-
//
|
|
385
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
386
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
386
387
|
function isGlobalPatchingSkipped(node) {
|
|
387
388
|
// we lazily compute this value instead of doing it during evaluation, this helps
|
|
388
389
|
// for apps that are setting this after the engine code is evaluated.
|
|
@@ -423,7 +424,7 @@
|
|
|
423
424
|
});
|
|
424
425
|
}
|
|
425
426
|
var lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
|
|
426
|
-
/** version: 2.
|
|
427
|
+
/** version: 2.33.0 */
|
|
427
428
|
|
|
428
429
|
/*
|
|
429
430
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1266,17 +1267,12 @@
|
|
|
1266
1267
|
},
|
|
1267
1268
|
textContent: {
|
|
1268
1269
|
get: function get() {
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
return textContentGetter.call(this);
|
|
1274
|
-
}
|
|
1275
|
-
// TODO [#1222]: remove global bypass
|
|
1276
|
-
if (isGlobalPatchingSkipped(this)) {
|
|
1277
|
-
return textContentGetter.call(this);
|
|
1270
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
1271
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
1272
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
1273
|
+
return textContentGetterPatched.call(this);
|
|
1278
1274
|
}
|
|
1279
|
-
return
|
|
1275
|
+
return textContentGetter.call(this);
|
|
1280
1276
|
},
|
|
1281
1277
|
set: textContentSetterPatched,
|
|
1282
1278
|
enumerable: true,
|
|
@@ -1337,7 +1333,8 @@
|
|
|
1337
1333
|
},
|
|
1338
1334
|
compareDocumentPosition: {
|
|
1339
1335
|
value: function value(otherNode) {
|
|
1340
|
-
//
|
|
1336
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
1337
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
1341
1338
|
if (isGlobalPatchingSkipped(this)) {
|
|
1342
1339
|
return compareDocumentPosition.call(this, otherNode);
|
|
1343
1340
|
}
|
|
@@ -1356,20 +1353,15 @@
|
|
|
1356
1353
|
if (this === otherNode) {
|
|
1357
1354
|
return true;
|
|
1358
1355
|
}
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
1364
|
-
return containsPatched.call(this, otherNode);
|
|
1365
|
-
}
|
|
1366
|
-
return contains.call(this, otherNode);
|
|
1356
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
1357
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
1358
|
+
if (otherNode == null) {
|
|
1359
|
+
return false;
|
|
1367
1360
|
}
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
return contains.call(this, otherNode);
|
|
1361
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
1362
|
+
return containsPatched.call(this, otherNode);
|
|
1371
1363
|
}
|
|
1372
|
-
return
|
|
1364
|
+
return contains.call(this, otherNode);
|
|
1373
1365
|
},
|
|
1374
1366
|
enumerable: true,
|
|
1375
1367
|
writable: true,
|
|
@@ -1377,17 +1369,9 @@
|
|
|
1377
1369
|
},
|
|
1378
1370
|
cloneNode: {
|
|
1379
1371
|
value: function value(deep) {
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
}
|
|
1384
|
-
return cloneNode.call(this, deep);
|
|
1385
|
-
}
|
|
1386
|
-
if (isTrue(deep)) {
|
|
1387
|
-
// TODO [#1222]: remove global bypass
|
|
1388
|
-
if (isGlobalPatchingSkipped(this)) {
|
|
1389
|
-
return cloneNode.call(this, deep);
|
|
1390
|
-
}
|
|
1372
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
1373
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
1374
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
1391
1375
|
return cloneNodePatched.call(this, deep);
|
|
1392
1376
|
}
|
|
1393
1377
|
return cloneNode.call(this, deep);
|
|
@@ -2324,7 +2308,8 @@
|
|
|
2324
2308
|
if (isNull(elm)) {
|
|
2325
2309
|
return null;
|
|
2326
2310
|
}
|
|
2327
|
-
//
|
|
2311
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
2312
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
2328
2313
|
return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm) ? elm : null;
|
|
2329
2314
|
},
|
|
2330
2315
|
writable: true,
|
|
@@ -2335,7 +2320,8 @@
|
|
|
2335
2320
|
value: function value() {
|
|
2336
2321
|
var elements = arrayFromCollection(querySelectorAll.apply(this, ArraySlice.call(arguments)));
|
|
2337
2322
|
var filtered = ArrayFind.call(elements,
|
|
2338
|
-
//
|
|
2323
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
2324
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
2339
2325
|
function (elm) {
|
|
2340
2326
|
return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
|
|
2341
2327
|
});
|
|
@@ -2349,7 +2335,8 @@
|
|
|
2349
2335
|
value: function value() {
|
|
2350
2336
|
var elements = arrayFromCollection(querySelectorAll.apply(this, ArraySlice.call(arguments)));
|
|
2351
2337
|
var filtered = ArrayFilter.call(elements,
|
|
2352
|
-
//
|
|
2338
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
2339
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
2353
2340
|
function (elm) {
|
|
2354
2341
|
return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
|
|
2355
2342
|
});
|
|
@@ -2363,7 +2350,8 @@
|
|
|
2363
2350
|
value: function value() {
|
|
2364
2351
|
var elements = arrayFromCollection(getElementsByClassName.apply(this, ArraySlice.call(arguments)));
|
|
2365
2352
|
var filtered = ArrayFilter.call(elements,
|
|
2366
|
-
//
|
|
2353
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
2354
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
2367
2355
|
function (elm) {
|
|
2368
2356
|
return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
|
|
2369
2357
|
});
|
|
@@ -2377,7 +2365,8 @@
|
|
|
2377
2365
|
value: function value() {
|
|
2378
2366
|
var elements = arrayFromCollection(getElementsByTagName.apply(this, ArraySlice.call(arguments)));
|
|
2379
2367
|
var filtered = ArrayFilter.call(elements,
|
|
2380
|
-
//
|
|
2368
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
2369
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
2381
2370
|
function (elm) {
|
|
2382
2371
|
return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
|
|
2383
2372
|
});
|
|
@@ -2391,7 +2380,8 @@
|
|
|
2391
2380
|
value: function value() {
|
|
2392
2381
|
var elements = arrayFromCollection(getElementsByTagNameNS.apply(this, ArraySlice.call(arguments)));
|
|
2393
2382
|
var filtered = ArrayFilter.call(elements,
|
|
2394
|
-
//
|
|
2383
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
2384
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
2395
2385
|
function (elm) {
|
|
2396
2386
|
return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
|
|
2397
2387
|
});
|
|
@@ -2407,7 +2397,8 @@
|
|
|
2407
2397
|
value: function value() {
|
|
2408
2398
|
var elements = arrayFromCollection(getElementsByName.apply(this, ArraySlice.call(arguments)));
|
|
2409
2399
|
var filtered = ArrayFilter.call(elements,
|
|
2410
|
-
//
|
|
2400
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
2401
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
2411
2402
|
function (elm) {
|
|
2412
2403
|
return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
|
|
2413
2404
|
});
|
|
@@ -3502,7 +3493,8 @@
|
|
|
3502
3493
|
} else if (context instanceof HTMLBodyElement) {
|
|
3503
3494
|
// `context` is document.body which is already patched.
|
|
3504
3495
|
filtered = ArrayFilter.call(unfilteredNodes,
|
|
3505
|
-
//
|
|
3496
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
3497
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
3506
3498
|
function (elm) {
|
|
3507
3499
|
return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(context);
|
|
3508
3500
|
});
|
|
@@ -3568,17 +3560,12 @@
|
|
|
3568
3560
|
defineProperties(Element.prototype, {
|
|
3569
3561
|
innerHTML: {
|
|
3570
3562
|
get: function get() {
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
return innerHTMLGetter.call(this);
|
|
3563
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
3564
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
3565
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
3566
|
+
return innerHTMLGetterPatched.call(this);
|
|
3576
3567
|
}
|
|
3577
|
-
|
|
3578
|
-
if (isGlobalPatchingSkipped(this)) {
|
|
3579
|
-
return innerHTMLGetter.call(this);
|
|
3580
|
-
}
|
|
3581
|
-
return innerHTMLGetterPatched.call(this);
|
|
3568
|
+
return innerHTMLGetter.call(this);
|
|
3582
3569
|
},
|
|
3583
3570
|
set: function set(v) {
|
|
3584
3571
|
innerHTMLSetter.call(this, v);
|
|
@@ -3588,17 +3575,12 @@
|
|
|
3588
3575
|
},
|
|
3589
3576
|
outerHTML: {
|
|
3590
3577
|
get: function get() {
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
return outerHTMLGetter.call(this);
|
|
3596
|
-
}
|
|
3597
|
-
// TODO [#1222]: remove global bypass
|
|
3598
|
-
if (isGlobalPatchingSkipped(this)) {
|
|
3599
|
-
return outerHTMLGetter.call(this);
|
|
3578
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
3579
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
3580
|
+
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
3581
|
+
return outerHTMLGetterPatched.call(this);
|
|
3600
3582
|
}
|
|
3601
|
-
return
|
|
3583
|
+
return outerHTMLGetter.call(this);
|
|
3602
3584
|
},
|
|
3603
3585
|
set: function set(v) {
|
|
3604
3586
|
outerHTMLSetter.call(this, v);
|
|
@@ -3700,35 +3682,24 @@
|
|
|
3700
3682
|
});
|
|
3701
3683
|
return isUndefined(elm) ? null : elm;
|
|
3702
3684
|
} else {
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
// Element is inside a shadow but we dont know which one. Use the
|
|
3708
|
-
// "nearest" owner key to filter by ownership.
|
|
3709
|
-
var contextNearestOwnerKey = getNodeNearestOwnerKey(this);
|
|
3710
|
-
var _elm = ArrayFind.call(nodeList, function (elm) {
|
|
3711
|
-
return getNodeNearestOwnerKey(elm) === contextNearestOwnerKey;
|
|
3712
|
-
});
|
|
3713
|
-
return isUndefined(_elm) ? null : _elm;
|
|
3685
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
3686
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
3687
|
+
// `this` is a manually inserted element inside a shadowRoot, return the first element.
|
|
3688
|
+
return nodeList.length === 0 ? null : nodeList[0];
|
|
3714
3689
|
}
|
|
3715
3690
|
} else {
|
|
3716
|
-
if (!
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
return isUndefined(_elm3) ? null : _elm3;
|
|
3720
|
-
}
|
|
3691
|
+
if (!(this instanceof HTMLBodyElement)) {
|
|
3692
|
+
var _elm2 = nodeList[0];
|
|
3693
|
+
return isUndefined(_elm2) ? null : _elm2;
|
|
3721
3694
|
}
|
|
3722
3695
|
// element belonging to the document
|
|
3723
|
-
var
|
|
3724
|
-
// TODO [#1222]: remove global bypass
|
|
3725
|
-
function (elm) {
|
|
3696
|
+
var _elm = ArrayFind.call(nodeList, function (elm) {
|
|
3726
3697
|
return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(_this3);
|
|
3727
3698
|
});
|
|
3728
|
-
return isUndefined(
|
|
3699
|
+
return isUndefined(_elm) ? null : _elm;
|
|
3729
3700
|
}
|
|
3730
3701
|
}
|
|
3731
|
-
function getFilteredArrayOfNodes(context, unfilteredNodes
|
|
3702
|
+
function getFilteredArrayOfNodes(context, unfilteredNodes) {
|
|
3732
3703
|
var filtered;
|
|
3733
3704
|
if (isSyntheticShadowHost(context)) {
|
|
3734
3705
|
// element with shadowRoot attached
|
|
@@ -3750,22 +3721,16 @@
|
|
|
3750
3721
|
filtered = ArrayFilter.call(unfilteredNodes, function (elm) {
|
|
3751
3722
|
return getNodeNearestOwnerKey(elm) === ownerKey;
|
|
3752
3723
|
});
|
|
3753
|
-
} else if (shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
|
|
3754
|
-
// context is inside a shadow, we dont know which one.
|
|
3755
|
-
var contextNearestOwnerKey = getNodeNearestOwnerKey(context);
|
|
3756
|
-
filtered = ArrayFilter.call(unfilteredNodes, function (elm) {
|
|
3757
|
-
return getNodeNearestOwnerKey(elm) === contextNearestOwnerKey;
|
|
3758
|
-
});
|
|
3759
3724
|
} else {
|
|
3760
|
-
//
|
|
3725
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
3726
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
3727
|
+
// context is manually inserted without lwc:dom-manual, return everything
|
|
3761
3728
|
filtered = ArraySlice.call(unfilteredNodes);
|
|
3762
3729
|
}
|
|
3763
3730
|
} else {
|
|
3764
|
-
if (context instanceof HTMLBodyElement
|
|
3731
|
+
if (context instanceof HTMLBodyElement) {
|
|
3765
3732
|
// `context` is document.body or element belonging to the document with the patch enabled
|
|
3766
|
-
filtered = ArrayFilter.call(unfilteredNodes,
|
|
3767
|
-
// TODO [#1222]: remove global bypass
|
|
3768
|
-
function (elm) {
|
|
3733
|
+
filtered = ArrayFilter.call(unfilteredNodes, function (elm) {
|
|
3769
3734
|
return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(context);
|
|
3770
3735
|
});
|
|
3771
3736
|
} else {
|
|
@@ -3794,13 +3759,11 @@
|
|
|
3794
3759
|
querySelectorAll: {
|
|
3795
3760
|
value: function value() {
|
|
3796
3761
|
var nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
return createStaticNodeList(getFilteredArrayOfNodes(this, nodeList, 1 /* ShadowDomSemantic.Enabled */));
|
|
3762
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
3763
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
3764
|
+
var filteredResults = getFilteredArrayOfNodes(this, nodeList);
|
|
3765
|
+
return createStaticNodeList(filteredResults);
|
|
3802
3766
|
},
|
|
3803
|
-
|
|
3804
3767
|
writable: true,
|
|
3805
3768
|
enumerable: true,
|
|
3806
3769
|
configurable: true
|
|
@@ -3812,11 +3775,9 @@
|
|
|
3812
3775
|
getElementsByClassName: {
|
|
3813
3776
|
value: function value() {
|
|
3814
3777
|
var elements = arrayFromCollection(getElementsByClassName$1.apply(this, ArraySlice.call(arguments)));
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
|
|
3819
|
-
return createStaticHTMLCollection(filteredResults);
|
|
3778
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
3779
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
3780
|
+
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
3820
3781
|
},
|
|
3821
3782
|
writable: true,
|
|
3822
3783
|
enumerable: true,
|
|
@@ -3825,11 +3786,9 @@
|
|
|
3825
3786
|
getElementsByTagName: {
|
|
3826
3787
|
value: function value() {
|
|
3827
3788
|
var elements = arrayFromCollection(getElementsByTagName$1.apply(this, ArraySlice.call(arguments)));
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
|
|
3832
|
-
return createStaticHTMLCollection(filteredResults);
|
|
3789
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
3790
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
3791
|
+
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
3833
3792
|
},
|
|
3834
3793
|
writable: true,
|
|
3835
3794
|
enumerable: true,
|
|
@@ -3838,11 +3797,9 @@
|
|
|
3838
3797
|
getElementsByTagNameNS: {
|
|
3839
3798
|
value: function value() {
|
|
3840
3799
|
var elements = arrayFromCollection(getElementsByTagNameNS$1.apply(this, ArraySlice.call(arguments)));
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
|
|
3845
|
-
return createStaticHTMLCollection(filteredResults);
|
|
3800
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
3801
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
3802
|
+
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
3846
3803
|
},
|
|
3847
3804
|
writable: true,
|
|
3848
3805
|
enumerable: true,
|
|
@@ -3855,199 +3812,6 @@
|
|
|
3855
3812
|
defineProperty(HTMLElement.prototype, 'getElementsByClassName', getOwnPropertyDescriptor(Element.prototype, 'getElementsByClassName'));
|
|
3856
3813
|
}
|
|
3857
3814
|
|
|
3858
|
-
/*
|
|
3859
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
3860
|
-
* All rights reserved.
|
|
3861
|
-
* SPDX-License-Identifier: MIT
|
|
3862
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3863
|
-
*/
|
|
3864
|
-
function getElementComputedStyle(element) {
|
|
3865
|
-
var win = getOwnerWindow(element);
|
|
3866
|
-
return windowGetComputedStyle.call(win, element);
|
|
3867
|
-
}
|
|
3868
|
-
function getWindowSelection(node) {
|
|
3869
|
-
var win = getOwnerWindow(node);
|
|
3870
|
-
return windowGetSelection.call(win);
|
|
3871
|
-
}
|
|
3872
|
-
function nodeIsBeingRendered(nodeComputedStyle) {
|
|
3873
|
-
return nodeComputedStyle.visibility === 'visible' && nodeComputedStyle.display !== 'none';
|
|
3874
|
-
}
|
|
3875
|
-
function getSelectionState(element) {
|
|
3876
|
-
var win = getOwnerWindow(element);
|
|
3877
|
-
var selection = getWindowSelection(element);
|
|
3878
|
-
if (selection === null) {
|
|
3879
|
-
return null;
|
|
3880
|
-
}
|
|
3881
|
-
var ranges = [];
|
|
3882
|
-
for (var i = 0; i < selection.rangeCount; i++) {
|
|
3883
|
-
ranges.push(selection.getRangeAt(i));
|
|
3884
|
-
}
|
|
3885
|
-
var state = {
|
|
3886
|
-
element: element,
|
|
3887
|
-
onselect: win.onselect,
|
|
3888
|
-
onselectstart: win.onselectstart,
|
|
3889
|
-
onselectionchange: win.onselectionchange,
|
|
3890
|
-
ranges: ranges
|
|
3891
|
-
};
|
|
3892
|
-
win.onselect = null;
|
|
3893
|
-
win.onselectstart = null;
|
|
3894
|
-
win.onselectionchange = null;
|
|
3895
|
-
return state;
|
|
3896
|
-
}
|
|
3897
|
-
function restoreSelectionState(state) {
|
|
3898
|
-
if (state === null) {
|
|
3899
|
-
return;
|
|
3900
|
-
}
|
|
3901
|
-
var element = state.element,
|
|
3902
|
-
onselect = state.onselect,
|
|
3903
|
-
onselectstart = state.onselectstart,
|
|
3904
|
-
onselectionchange = state.onselectionchange,
|
|
3905
|
-
ranges = state.ranges;
|
|
3906
|
-
var win = getOwnerWindow(element);
|
|
3907
|
-
var selection = getWindowSelection(element);
|
|
3908
|
-
selection.removeAllRanges();
|
|
3909
|
-
for (var i = 0; i < ranges.length; i++) {
|
|
3910
|
-
selection.addRange(ranges[i]);
|
|
3911
|
-
}
|
|
3912
|
-
win.onselect = onselect;
|
|
3913
|
-
win.onselectstart = onselectstart;
|
|
3914
|
-
win.onselectionchange = onselectionchange;
|
|
3915
|
-
}
|
|
3916
|
-
/**
|
|
3917
|
-
* Gets the "innerText" of a text node using the Selection API
|
|
3918
|
-
*
|
|
3919
|
-
* NOTE: For performance reasons, since this function will be called multiple times while calculating the innerText of
|
|
3920
|
-
* an element, it does not restore the current selection.
|
|
3921
|
-
*/
|
|
3922
|
-
function getTextNodeInnerText(textNode) {
|
|
3923
|
-
var selection = getWindowSelection(textNode);
|
|
3924
|
-
if (selection === null) {
|
|
3925
|
-
return textNode.textContent || '';
|
|
3926
|
-
}
|
|
3927
|
-
var range = document.createRange();
|
|
3928
|
-
range.selectNodeContents(textNode);
|
|
3929
|
-
var domRect = range.getBoundingClientRect();
|
|
3930
|
-
if (domRect.height <= 0 || domRect.width <= 0) {
|
|
3931
|
-
// the text node is not rendered
|
|
3932
|
-
return '';
|
|
3933
|
-
}
|
|
3934
|
-
// Needed to remove non rendered characters from the text node.
|
|
3935
|
-
selection.removeAllRanges();
|
|
3936
|
-
selection.addRange(range);
|
|
3937
|
-
var selectionText = selection.toString();
|
|
3938
|
-
// The textNode is visible, but it may not be selectable. When the text is not selectable,
|
|
3939
|
-
// textContent is the nearest approximation to innerText.
|
|
3940
|
-
return selectionText ? selectionText : textNode.textContent || '';
|
|
3941
|
-
}
|
|
3942
|
-
var nodeIsElement = function nodeIsElement(node) {
|
|
3943
|
-
return node.nodeType === ELEMENT_NODE;
|
|
3944
|
-
};
|
|
3945
|
-
var nodeIsText = function nodeIsText(node) {
|
|
3946
|
-
return node.nodeType === TEXT_NODE;
|
|
3947
|
-
};
|
|
3948
|
-
/**
|
|
3949
|
-
* Spec: https://html.spec.whatwg.org/multipage/dom.html#inner-text-collection-steps
|
|
3950
|
-
* One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1132
|
|
3951
|
-
*/
|
|
3952
|
-
function innerTextCollectionSteps(node) {
|
|
3953
|
-
var items = [];
|
|
3954
|
-
if (nodeIsElement(node)) {
|
|
3955
|
-
var tagName = node.tagName;
|
|
3956
|
-
var computedStyle = getElementComputedStyle(node);
|
|
3957
|
-
if (tagName === 'OPTION') {
|
|
3958
|
-
// For options, is hard to get the "rendered" text, let's use the original getter.
|
|
3959
|
-
return [1, innerTextGetter.call(node), 1];
|
|
3960
|
-
} else if (tagName === 'TEXTAREA') {
|
|
3961
|
-
return [];
|
|
3962
|
-
} else {
|
|
3963
|
-
var childNodes = node.childNodes;
|
|
3964
|
-
for (var i = 0, n = childNodes.length; i < n; i++) {
|
|
3965
|
-
ArrayPush.apply(items, innerTextCollectionSteps(childNodes[i]));
|
|
3966
|
-
}
|
|
3967
|
-
}
|
|
3968
|
-
if (!nodeIsBeingRendered(computedStyle)) {
|
|
3969
|
-
if (tagName === 'SELECT' || tagName === 'DATALIST') {
|
|
3970
|
-
// the select is either: .visibility != 'visible' or .display === hidden, therefore this select should
|
|
3971
|
-
// not display any value.
|
|
3972
|
-
return [];
|
|
3973
|
-
}
|
|
3974
|
-
return items;
|
|
3975
|
-
}
|
|
3976
|
-
if (tagName === 'BR') {
|
|
3977
|
-
items.push("\n" /* line feed */);
|
|
3978
|
-
}
|
|
3979
|
-
|
|
3980
|
-
var display = computedStyle.display;
|
|
3981
|
-
if (display === 'table-cell') {
|
|
3982
|
-
// omitting case: and node's CSS box is not the last 'table-cell' box of its enclosing 'table-row' box
|
|
3983
|
-
items.push("\t" /* tab */);
|
|
3984
|
-
}
|
|
3985
|
-
|
|
3986
|
-
if (display === 'table-row') {
|
|
3987
|
-
// omitting case: and node's CSS box is not the last 'table-row' box of the nearest ancestor 'table' box
|
|
3988
|
-
items.push("\n" /* line feed */);
|
|
3989
|
-
}
|
|
3990
|
-
|
|
3991
|
-
if (tagName === 'P') {
|
|
3992
|
-
items.unshift(2);
|
|
3993
|
-
items.push(2);
|
|
3994
|
-
}
|
|
3995
|
-
if (display === 'block' || display === 'table-caption' || display === 'flex' || display === 'table') {
|
|
3996
|
-
items.unshift(1);
|
|
3997
|
-
items.push(1);
|
|
3998
|
-
}
|
|
3999
|
-
} else if (nodeIsText(node)) {
|
|
4000
|
-
items.push(getTextNodeInnerText(node));
|
|
4001
|
-
}
|
|
4002
|
-
return items;
|
|
4003
|
-
}
|
|
4004
|
-
/**
|
|
4005
|
-
* InnerText getter spec: https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute
|
|
4006
|
-
*
|
|
4007
|
-
* One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1087
|
|
4008
|
-
*/
|
|
4009
|
-
function getInnerText(element) {
|
|
4010
|
-
var thisComputedStyle = getElementComputedStyle(element);
|
|
4011
|
-
if (!nodeIsBeingRendered(thisComputedStyle)) {
|
|
4012
|
-
return getTextContent(element) || '';
|
|
4013
|
-
}
|
|
4014
|
-
var selectionState = getSelectionState(element);
|
|
4015
|
-
var results = [];
|
|
4016
|
-
var childNodes = element.childNodes;
|
|
4017
|
-
for (var i = 0, n = childNodes.length; i < n; i++) {
|
|
4018
|
-
ArrayPush.apply(results, innerTextCollectionSteps(childNodes[i]));
|
|
4019
|
-
}
|
|
4020
|
-
restoreSelectionState(selectionState);
|
|
4021
|
-
var elementInnerText = '';
|
|
4022
|
-
var maxReqLineBreakCount = 0;
|
|
4023
|
-
for (var _i = 0, _n = results.length; _i < _n; _i++) {
|
|
4024
|
-
var item = results[_i];
|
|
4025
|
-
if (typeof item === 'string') {
|
|
4026
|
-
if (maxReqLineBreakCount > 0) {
|
|
4027
|
-
for (var j = 0; j < maxReqLineBreakCount; j++) {
|
|
4028
|
-
elementInnerText += "\n";
|
|
4029
|
-
}
|
|
4030
|
-
maxReqLineBreakCount = 0;
|
|
4031
|
-
}
|
|
4032
|
-
if (item.length > 0) {
|
|
4033
|
-
elementInnerText += item;
|
|
4034
|
-
}
|
|
4035
|
-
} else {
|
|
4036
|
-
if (elementInnerText.length == 0) {
|
|
4037
|
-
// Remove required line break count at the start.
|
|
4038
|
-
continue;
|
|
4039
|
-
}
|
|
4040
|
-
// Store the count if it's the max of this run,
|
|
4041
|
-
// but it may be ignored if no text item is found afterwards,
|
|
4042
|
-
// which means that these are consecutive line breaks at the end.
|
|
4043
|
-
if (item > maxReqLineBreakCount) {
|
|
4044
|
-
maxReqLineBreakCount = item;
|
|
4045
|
-
}
|
|
4046
|
-
}
|
|
4047
|
-
}
|
|
4048
|
-
return elementInnerText;
|
|
4049
|
-
}
|
|
4050
|
-
|
|
4051
3815
|
/*
|
|
4052
3816
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4053
3817
|
* All rights reserved.
|
|
@@ -4517,20 +4281,9 @@
|
|
|
4517
4281
|
if (innerTextGetter !== null && innerTextSetter !== null) {
|
|
4518
4282
|
defineProperty(HTMLElement.prototype, 'innerText', {
|
|
4519
4283
|
get: function get() {
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
4524
|
-
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
4525
|
-
return getInnerText(this);
|
|
4526
|
-
}
|
|
4527
|
-
return innerTextGetter.call(this);
|
|
4528
|
-
}
|
|
4529
|
-
// TODO [#1222]: remove global bypass
|
|
4530
|
-
if (isGlobalPatchingSkipped(this)) {
|
|
4531
|
-
return innerTextGetter.call(this);
|
|
4532
|
-
}
|
|
4533
|
-
return getInnerText(this);
|
|
4284
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
4285
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
4286
|
+
return innerTextGetter.call(this);
|
|
4534
4287
|
},
|
|
4535
4288
|
set: function set(v) {
|
|
4536
4289
|
innerTextSetter.call(this, v);
|
|
@@ -4546,20 +4299,9 @@
|
|
|
4546
4299
|
// As a setter, it removes the current node and replaces it with the given text.
|
|
4547
4300
|
defineProperty(HTMLElement.prototype, 'outerText', {
|
|
4548
4301
|
get: function get() {
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
|
|
4553
|
-
if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
|
|
4554
|
-
return getInnerText(this);
|
|
4555
|
-
}
|
|
4556
|
-
return outerTextGetter.call(this);
|
|
4557
|
-
}
|
|
4558
|
-
// TODO [#1222]: remove global bypass
|
|
4559
|
-
if (isGlobalPatchingSkipped(this)) {
|
|
4560
|
-
return outerTextGetter.call(this);
|
|
4561
|
-
}
|
|
4562
|
-
return getInnerText(this);
|
|
4302
|
+
// Note: we deviate from native shadow here, but are not fixing
|
|
4303
|
+
// due to backwards compat: https://github.com/salesforce/lwc/pull/3103
|
|
4304
|
+
return outerTextGetter.call(this);
|
|
4563
4305
|
},
|
|
4564
4306
|
set: function set(v) {
|
|
4565
4307
|
// Invoking the `outerText` setter on a host element should trigger its disconnection, but until we merge node reactions, it will not work.
|
|
@@ -4698,8 +4440,8 @@
|
|
|
4698
4440
|
adoptChildNode(node, DocumentResolverFn, undefined);
|
|
4699
4441
|
}
|
|
4700
4442
|
}
|
|
4701
|
-
for (var
|
|
4702
|
-
var _node = addedNodes[
|
|
4443
|
+
for (var _i = 0, _len = addedNodes.length; _i < _len; _i += 1) {
|
|
4444
|
+
var _node = addedNodes[_i];
|
|
4703
4445
|
if (compareDocumentPosition.call(elm, _node) & _Node.DOCUMENT_POSITION_CONTAINED_BY) {
|
|
4704
4446
|
adoptChildNode(_node, fn, shadowToken);
|
|
4705
4447
|
}
|
|
@@ -4748,6 +4490,6 @@
|
|
|
4748
4490
|
},
|
|
4749
4491
|
configurable: true
|
|
4750
4492
|
});
|
|
4751
|
-
/** version: 2.
|
|
4493
|
+
/** version: 2.33.0 */
|
|
4752
4494
|
|
|
4753
4495
|
})();
|