lwc 2.13.0 → 2.13.3
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 +155 -145
- package/dist/engine-dom/iife/es2017/engine-dom.js +155 -145
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +143 -133
- package/dist/engine-dom/iife/es5/engine-dom.js +162 -142
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +144 -124
- package/dist/engine-dom/umd/es2017/engine-dom.js +155 -145
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +143 -133
- package/dist/engine-dom/umd/es5/engine-dom.js +162 -142
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +144 -124
- package/dist/engine-server/commonjs/es2017/engine-server.js +132 -124
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +132 -124
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +693 -693
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +693 -693
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +681 -681
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +686 -686
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +1 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +697 -697
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +693 -693
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +681 -681
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +686 -686
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +1 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +697 -697
- 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 +5 -5
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +5 -5
- 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 +5 -5
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +5 -5
- package/package.json +7 -7
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
var hasNativeSymbolSupport = /*@__PURE__*/ function() {
|
|
163
163
|
return Symbol("x").toString() === "Symbol(x)";
|
|
164
164
|
}();
|
|
165
|
-
/** version: 2.13.
|
|
165
|
+
/** version: 2.13.3 */ /*
|
|
166
166
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
167
167
|
* All rights reserved.
|
|
168
168
|
* SPDX-License-Identifier: MIT
|
|
@@ -406,238 +406,6 @@
|
|
|
406
406
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
407
407
|
*/ var eventTargetPrototype = typeof EventTarget !== "undefined" ? EventTarget.prototype : _Node.prototype;
|
|
408
408
|
var addEventListener = eventTargetPrototype.addEventListener, dispatchEvent = eventTargetPrototype.dispatchEvent, removeEventListener = eventTargetPrototype.removeEventListener;
|
|
409
|
-
/*
|
|
410
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
411
|
-
* All rights reserved.
|
|
412
|
-
* SPDX-License-Identifier: MIT
|
|
413
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
414
|
-
*/ var EventListenerMap = new WeakMap();
|
|
415
|
-
var ComposedPathMap = new WeakMap();
|
|
416
|
-
function isEventListenerOrEventListenerObject(fnOrObj) {
|
|
417
|
-
return isFunction(fnOrObj) || isObject(fnOrObj) && !isNull(fnOrObj) && isFunction(fnOrObj.handleEvent);
|
|
418
|
-
}
|
|
419
|
-
function shouldInvokeListener(event, target, currentTarget) {
|
|
420
|
-
// Subsequent logic assumes that `currentTarget` must be contained in the composed path for the listener to be
|
|
421
|
-
// invoked, but this is not always the case. `composedPath()` will sometimes return an empty array, even when the
|
|
422
|
-
// listener should be invoked (e.g., a disconnected instance of EventTarget, an instance of XMLHttpRequest, etc).
|
|
423
|
-
if (target === currentTarget) {
|
|
424
|
-
return true;
|
|
425
|
-
}
|
|
426
|
-
var composedPath1 = ComposedPathMap.get(event);
|
|
427
|
-
if (isUndefined(composedPath1)) {
|
|
428
|
-
composedPath1 = event.composedPath();
|
|
429
|
-
ComposedPathMap.set(event, composedPath1);
|
|
430
|
-
}
|
|
431
|
-
return composedPath1.includes(currentTarget);
|
|
432
|
-
}
|
|
433
|
-
function getEventListenerWrapper(fnOrObj) {
|
|
434
|
-
if (!isEventListenerOrEventListenerObject(fnOrObj)) {
|
|
435
|
-
return fnOrObj;
|
|
436
|
-
}
|
|
437
|
-
var wrapperFn = EventListenerMap.get(fnOrObj);
|
|
438
|
-
if (isUndefined(wrapperFn)) {
|
|
439
|
-
wrapperFn = function wrapperFn(event) {
|
|
440
|
-
// This function is invoked from an event listener and currentTarget is always defined.
|
|
441
|
-
var currentTarget = eventCurrentTargetGetter.call(event);
|
|
442
|
-
if (process.env.NODE_ENV !== "production") {
|
|
443
|
-
assert.invariant(isFalse(isSyntheticShadowHost(currentTarget)), "This routine should not be used to wrap event listeners for host elements and shadow roots.");
|
|
444
|
-
}
|
|
445
|
-
var actualTarget = getActualTarget(event);
|
|
446
|
-
if (!shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
return isFunction(fnOrObj) ? fnOrObj.call(this, event) : fnOrObj.handleEvent && fnOrObj.handleEvent(event);
|
|
450
|
-
};
|
|
451
|
-
EventListenerMap.set(fnOrObj, wrapperFn);
|
|
452
|
-
}
|
|
453
|
-
return wrapperFn;
|
|
454
|
-
}
|
|
455
|
-
/*
|
|
456
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
457
|
-
* All rights reserved.
|
|
458
|
-
* SPDX-License-Identifier: MIT
|
|
459
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
460
|
-
*/ var eventToContextMap = new WeakMap();
|
|
461
|
-
var customElementToWrappedListeners = new WeakMap();
|
|
462
|
-
function getEventMap(elm) {
|
|
463
|
-
var listenerInfo = customElementToWrappedListeners.get(elm);
|
|
464
|
-
if (isUndefined(listenerInfo)) {
|
|
465
|
-
listenerInfo = create(null);
|
|
466
|
-
customElementToWrappedListeners.set(elm, listenerInfo);
|
|
467
|
-
}
|
|
468
|
-
return listenerInfo;
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Events dispatched on shadow roots actually end up being dispatched on their hosts. This means that the event.target
|
|
472
|
-
* property of events dispatched on shadow roots always resolve to their host. This function understands this
|
|
473
|
-
* abstraction and properly returns a reference to the shadow root when appropriate.
|
|
474
|
-
*/ function getActualTarget(event) {
|
|
475
|
-
var _a;
|
|
476
|
-
return (_a = eventToShadowRootMap.get(event)) !== null && _a !== void 0 ? _a : eventTargetGetter.call(event);
|
|
477
|
-
}
|
|
478
|
-
var shadowRootEventListenerMap = new WeakMap();
|
|
479
|
-
function getWrappedShadowRootListener(listener) {
|
|
480
|
-
if (!isFunction(listener)) {
|
|
481
|
-
throw new TypeError(); // avoiding problems with non-valid listeners
|
|
482
|
-
}
|
|
483
|
-
var shadowRootWrappedListener = shadowRootEventListenerMap.get(listener);
|
|
484
|
-
if (isUndefined(shadowRootWrappedListener)) {
|
|
485
|
-
shadowRootWrappedListener = function shadowRootWrappedListener(event) {
|
|
486
|
-
// currentTarget is always defined inside an event listener
|
|
487
|
-
var currentTarget = eventCurrentTargetGetter.call(event);
|
|
488
|
-
// If currentTarget is not an instance of a native shadow root then we're dealing with a
|
|
489
|
-
// host element whose synthetic shadow root must be accessed via getShadowRoot().
|
|
490
|
-
if (!isInstanceOfNativeShadowRoot(currentTarget)) {
|
|
491
|
-
currentTarget = getShadowRoot(currentTarget);
|
|
492
|
-
}
|
|
493
|
-
var actualTarget = getActualTarget(event);
|
|
494
|
-
if (shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
495
|
-
listener.call(currentTarget, event);
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
shadowRootWrappedListener.placement = 1 /* SHADOW_ROOT_LISTENER */ ;
|
|
499
|
-
shadowRootEventListenerMap.set(listener, shadowRootWrappedListener);
|
|
500
|
-
}
|
|
501
|
-
return shadowRootWrappedListener;
|
|
502
|
-
}
|
|
503
|
-
var customElementEventListenerMap = new WeakMap();
|
|
504
|
-
function getWrappedCustomElementListener(listener) {
|
|
505
|
-
if (!isFunction(listener)) {
|
|
506
|
-
throw new TypeError(); // avoiding problems with non-valid listeners
|
|
507
|
-
}
|
|
508
|
-
var customElementWrappedListener = customElementEventListenerMap.get(listener);
|
|
509
|
-
if (isUndefined(customElementWrappedListener)) {
|
|
510
|
-
customElementWrappedListener = function customElementWrappedListener(event) {
|
|
511
|
-
// currentTarget is always defined inside an event listener
|
|
512
|
-
var currentTarget = eventCurrentTargetGetter.call(event);
|
|
513
|
-
var actualTarget = getActualTarget(event);
|
|
514
|
-
if (shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
515
|
-
listener.call(currentTarget, event);
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
customElementWrappedListener.placement = 0 /* CUSTOM_ELEMENT_LISTENER */ ;
|
|
519
|
-
customElementEventListenerMap.set(listener, customElementWrappedListener);
|
|
520
|
-
}
|
|
521
|
-
return customElementWrappedListener;
|
|
522
|
-
}
|
|
523
|
-
function domListener(evt) {
|
|
524
|
-
var invokeListenersByPlacement = function invokeListenersByPlacement(placement) {
|
|
525
|
-
forEach.call(bookkeeping, function(listener) {
|
|
526
|
-
if (isFalse(immediatePropagationStopped) && listener.placement === placement) {
|
|
527
|
-
// making sure that the listener was not removed from the original listener queue
|
|
528
|
-
if (ArrayIndexOf.call(listeners, listener) !== -1) {
|
|
529
|
-
// all handlers on the custom element should be called with undefined 'this'
|
|
530
|
-
listener.call(undefined, evt);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
});
|
|
534
|
-
};
|
|
535
|
-
var immediatePropagationStopped = false;
|
|
536
|
-
var propagationStopped = false;
|
|
537
|
-
var type = evt.type, stopImmediatePropagation = evt.stopImmediatePropagation, stopPropagation = evt.stopPropagation;
|
|
538
|
-
// currentTarget is always defined
|
|
539
|
-
var currentTarget = eventCurrentTargetGetter.call(evt);
|
|
540
|
-
var listenerMap = getEventMap(currentTarget);
|
|
541
|
-
var listeners = listenerMap[type]; // it must have listeners at this point
|
|
542
|
-
defineProperty(evt, "stopImmediatePropagation", {
|
|
543
|
-
value: function value() {
|
|
544
|
-
immediatePropagationStopped = true;
|
|
545
|
-
stopImmediatePropagation.call(evt);
|
|
546
|
-
},
|
|
547
|
-
writable: true,
|
|
548
|
-
enumerable: true,
|
|
549
|
-
configurable: true
|
|
550
|
-
});
|
|
551
|
-
defineProperty(evt, "stopPropagation", {
|
|
552
|
-
value: function value() {
|
|
553
|
-
propagationStopped = true;
|
|
554
|
-
stopPropagation.call(evt);
|
|
555
|
-
},
|
|
556
|
-
writable: true,
|
|
557
|
-
enumerable: true,
|
|
558
|
-
configurable: true
|
|
559
|
-
});
|
|
560
|
-
// in case a listener adds or removes other listeners during invocation
|
|
561
|
-
var bookkeeping = ArraySlice.call(listeners);
|
|
562
|
-
eventToContextMap.set(evt, 1 /* SHADOW_ROOT_LISTENER */ );
|
|
563
|
-
invokeListenersByPlacement(1 /* SHADOW_ROOT_LISTENER */ );
|
|
564
|
-
if (isFalse(immediatePropagationStopped) && isFalse(propagationStopped)) {
|
|
565
|
-
// doing the second iteration only if the first one didn't interrupt the event propagation
|
|
566
|
-
eventToContextMap.set(evt, 0 /* CUSTOM_ELEMENT_LISTENER */ );
|
|
567
|
-
invokeListenersByPlacement(0 /* CUSTOM_ELEMENT_LISTENER */ );
|
|
568
|
-
}
|
|
569
|
-
eventToContextMap.set(evt, 2 /* UNKNOWN_LISTENER */ );
|
|
570
|
-
}
|
|
571
|
-
function attachDOMListener(elm, type, wrappedListener) {
|
|
572
|
-
var listenerMap = getEventMap(elm);
|
|
573
|
-
var cmpEventHandlers = listenerMap[type];
|
|
574
|
-
if (isUndefined(cmpEventHandlers)) {
|
|
575
|
-
cmpEventHandlers = listenerMap[type] = [];
|
|
576
|
-
}
|
|
577
|
-
// Prevent identical listeners from subscribing to the same event type.
|
|
578
|
-
// TODO [#1824]: Options will also play a factor when we introduce support for them (#1824).
|
|
579
|
-
if (ArrayIndexOf.call(cmpEventHandlers, wrappedListener) !== -1) {
|
|
580
|
-
return;
|
|
581
|
-
}
|
|
582
|
-
// only add to DOM if there is no other listener on the same placement yet
|
|
583
|
-
if (cmpEventHandlers.length === 0) {
|
|
584
|
-
// super.addEventListener() - this will not work on
|
|
585
|
-
addEventListener.call(elm, type, domListener);
|
|
586
|
-
}
|
|
587
|
-
ArrayPush.call(cmpEventHandlers, wrappedListener);
|
|
588
|
-
}
|
|
589
|
-
function detachDOMListener(elm, type, wrappedListener) {
|
|
590
|
-
var listenerMap = getEventMap(elm);
|
|
591
|
-
var p;
|
|
592
|
-
var listeners;
|
|
593
|
-
if (!isUndefined(listeners = listenerMap[type]) && (p = ArrayIndexOf.call(listeners, wrappedListener)) !== -1) {
|
|
594
|
-
ArraySplice.call(listeners, p, 1);
|
|
595
|
-
// only remove from DOM if there is no other listener on the same placement
|
|
596
|
-
if (listeners.length === 0) {
|
|
597
|
-
removeEventListener.call(elm, type, domListener);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
function addCustomElementEventListener(type, listener, _options) {
|
|
602
|
-
if (process.env.NODE_ENV !== "production") {
|
|
603
|
-
if (!isFunction(listener)) {
|
|
604
|
-
throw new TypeError("Invalid second argument for Element.addEventListener() in ".concat(toString(this), ' for event "').concat(type, '". Expected an EventListener but received ').concat(listener, "."));
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
// TODO [#1824]: Lift this restriction on the option parameter
|
|
608
|
-
if (isFunction(listener)) {
|
|
609
|
-
var wrappedListener = getWrappedCustomElementListener(listener);
|
|
610
|
-
attachDOMListener(this, type, wrappedListener);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
function removeCustomElementEventListener(type, listener, _options) {
|
|
614
|
-
// TODO [#1824]: Lift this restriction on the option parameter
|
|
615
|
-
if (isFunction(listener)) {
|
|
616
|
-
var wrappedListener = getWrappedCustomElementListener(listener);
|
|
617
|
-
detachDOMListener(this, type, wrappedListener);
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
function addShadowRootEventListener(sr, type, listener, _options) {
|
|
621
|
-
if (process.env.NODE_ENV !== "production") {
|
|
622
|
-
if (!isFunction(listener)) {
|
|
623
|
-
throw new TypeError("Invalid second argument for ShadowRoot.addEventListener() in ".concat(toString(sr), ' for event "').concat(type, '". Expected an EventListener but received ').concat(listener, "."));
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
// TODO [#1824]: Lift this restriction on the option parameter
|
|
627
|
-
if (isFunction(listener)) {
|
|
628
|
-
var elm = getHost(sr);
|
|
629
|
-
var wrappedListener = getWrappedShadowRootListener(listener);
|
|
630
|
-
attachDOMListener(elm, type, wrappedListener);
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
function removeShadowRootEventListener(sr, type, listener, _options) {
|
|
634
|
-
// TODO [#1824]: Lift this restriction on the option parameter
|
|
635
|
-
if (isFunction(listener)) {
|
|
636
|
-
var elm = getHost(sr);
|
|
637
|
-
var wrappedListener = getWrappedShadowRootListener(listener);
|
|
638
|
-
detachDOMListener(elm, type, wrappedListener);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
409
|
/*
|
|
642
410
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
643
411
|
* All rights reserved.
|
|
@@ -896,31 +664,149 @@
|
|
|
896
664
|
* All rights reserved.
|
|
897
665
|
* SPDX-License-Identifier: MIT
|
|
898
666
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
899
|
-
*/ function
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
var content = "";
|
|
905
|
-
for(var i = 0, len = childNodes.length; i < len; i += 1){
|
|
906
|
-
var currentNode = childNodes[i];
|
|
907
|
-
if (currentNode.nodeType !== COMMENT_NODE) {
|
|
908
|
-
content += getTextContent(currentNode);
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
return content;
|
|
912
|
-
}
|
|
913
|
-
default:
|
|
914
|
-
return node.nodeValue;
|
|
667
|
+
*/ function getInnerHTML(node) {
|
|
668
|
+
var s = "";
|
|
669
|
+
var childNodes = getFilteredChildNodes(node);
|
|
670
|
+
for(var i = 0, len = childNodes.length; i < len; i += 1){
|
|
671
|
+
s += getOuterHTML(childNodes[i]);
|
|
915
672
|
}
|
|
673
|
+
return s;
|
|
916
674
|
}
|
|
917
675
|
/*
|
|
918
676
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
919
677
|
* All rights reserved.
|
|
920
678
|
* SPDX-License-Identifier: MIT
|
|
921
679
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
922
|
-
*/
|
|
923
|
-
|
|
680
|
+
*/ // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#escapingString
|
|
681
|
+
var escapeAttrRegExp = /[&\u00A0"]/g;
|
|
682
|
+
var escapeDataRegExp = /[&\u00A0<>]/g;
|
|
683
|
+
var _prototype5 = String.prototype, replace = _prototype5.replace, toLowerCase = _prototype5.toLowerCase;
|
|
684
|
+
function escapeReplace(c) {
|
|
685
|
+
switch(c){
|
|
686
|
+
case "&":
|
|
687
|
+
return "&";
|
|
688
|
+
case "<":
|
|
689
|
+
return "<";
|
|
690
|
+
case ">":
|
|
691
|
+
return ">";
|
|
692
|
+
case '"':
|
|
693
|
+
return """;
|
|
694
|
+
case "\xa0":
|
|
695
|
+
return " ";
|
|
696
|
+
default:
|
|
697
|
+
return "";
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
function escapeAttr(s) {
|
|
701
|
+
return replace.call(s, escapeAttrRegExp, escapeReplace);
|
|
702
|
+
}
|
|
703
|
+
function escapeData(s) {
|
|
704
|
+
return replace.call(s, escapeDataRegExp, escapeReplace);
|
|
705
|
+
}
|
|
706
|
+
// http://www.whatwg.org/specs/web-apps/current-work/#void-elements
|
|
707
|
+
var voidElements = new Set([
|
|
708
|
+
"AREA",
|
|
709
|
+
"BASE",
|
|
710
|
+
"BR",
|
|
711
|
+
"COL",
|
|
712
|
+
"COMMAND",
|
|
713
|
+
"EMBED",
|
|
714
|
+
"HR",
|
|
715
|
+
"IMG",
|
|
716
|
+
"INPUT",
|
|
717
|
+
"KEYGEN",
|
|
718
|
+
"LINK",
|
|
719
|
+
"META",
|
|
720
|
+
"PARAM",
|
|
721
|
+
"SOURCE",
|
|
722
|
+
"TRACK",
|
|
723
|
+
"WBR",
|
|
724
|
+
]);
|
|
725
|
+
var plaintextParents = new Set([
|
|
726
|
+
"STYLE",
|
|
727
|
+
"SCRIPT",
|
|
728
|
+
"XMP",
|
|
729
|
+
"IFRAME",
|
|
730
|
+
"NOEMBED",
|
|
731
|
+
"NOFRAMES",
|
|
732
|
+
"PLAINTEXT",
|
|
733
|
+
"NOSCRIPT",
|
|
734
|
+
]);
|
|
735
|
+
function getOuterHTML(node) {
|
|
736
|
+
switch(node.nodeType){
|
|
737
|
+
case ELEMENT_NODE:
|
|
738
|
+
{
|
|
739
|
+
var attrs = node.attributes;
|
|
740
|
+
var tagName = tagNameGetter.call(node);
|
|
741
|
+
var s = "<" + toLowerCase.call(tagName);
|
|
742
|
+
for(var i = 0, attr; attr = attrs[i]; i++){
|
|
743
|
+
s += " " + attr.name + '="' + escapeAttr(attr.value) + '"';
|
|
744
|
+
}
|
|
745
|
+
s += ">";
|
|
746
|
+
if (voidElements.has(tagName)) {
|
|
747
|
+
return s;
|
|
748
|
+
}
|
|
749
|
+
return s + getInnerHTML(node) + "</" + toLowerCase.call(tagName) + ">";
|
|
750
|
+
}
|
|
751
|
+
case TEXT_NODE:
|
|
752
|
+
{
|
|
753
|
+
var data = node.data, parentNode = node.parentNode;
|
|
754
|
+
if (_instanceof(parentNode, Element) && plaintextParents.has(tagNameGetter.call(parentNode))) {
|
|
755
|
+
return data;
|
|
756
|
+
}
|
|
757
|
+
return escapeData(data);
|
|
758
|
+
}
|
|
759
|
+
case CDATA_SECTION_NODE:
|
|
760
|
+
{
|
|
761
|
+
return "<!CDATA[[".concat(node.data, "]]>");
|
|
762
|
+
}
|
|
763
|
+
case PROCESSING_INSTRUCTION_NODE:
|
|
764
|
+
{
|
|
765
|
+
return "<?".concat(node.target, " ").concat(node.data, "?>");
|
|
766
|
+
}
|
|
767
|
+
case COMMENT_NODE:
|
|
768
|
+
{
|
|
769
|
+
return "<!--".concat(node.data, "-->");
|
|
770
|
+
}
|
|
771
|
+
default:
|
|
772
|
+
{
|
|
773
|
+
// intentionally ignoring unknown node types
|
|
774
|
+
// Note: since this routine is always invoked for childNodes
|
|
775
|
+
// we can safety ignore type 9, 10 and 99 (document, fragment and doctype)
|
|
776
|
+
return "";
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
/*
|
|
781
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
782
|
+
* All rights reserved.
|
|
783
|
+
* SPDX-License-Identifier: MIT
|
|
784
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
785
|
+
*/ function getTextContent(node) {
|
|
786
|
+
switch(node.nodeType){
|
|
787
|
+
case ELEMENT_NODE:
|
|
788
|
+
{
|
|
789
|
+
var childNodes = getFilteredChildNodes(node);
|
|
790
|
+
var content = "";
|
|
791
|
+
for(var i = 0, len = childNodes.length; i < len; i += 1){
|
|
792
|
+
var currentNode = childNodes[i];
|
|
793
|
+
if (currentNode.nodeType !== COMMENT_NODE) {
|
|
794
|
+
content += getTextContent(currentNode);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
return content;
|
|
798
|
+
}
|
|
799
|
+
default:
|
|
800
|
+
return node.nodeValue;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
/*
|
|
804
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
805
|
+
* All rights reserved.
|
|
806
|
+
* SPDX-License-Identifier: MIT
|
|
807
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
808
|
+
*/ var Items$1 = new WeakMap();
|
|
809
|
+
function StaticNodeList() {
|
|
924
810
|
throw new TypeError("Illegal constructor");
|
|
925
811
|
}
|
|
926
812
|
var _obj;
|
|
@@ -1032,6 +918,67 @@
|
|
|
1032
918
|
});
|
|
1033
919
|
return nodeList;
|
|
1034
920
|
}
|
|
921
|
+
/*
|
|
922
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
923
|
+
* All rights reserved.
|
|
924
|
+
* SPDX-License-Identifier: MIT
|
|
925
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
926
|
+
*/ // Walk up the DOM tree, collecting all shadow roots plus the document root
|
|
927
|
+
function getAllRootNodes(node) {
|
|
928
|
+
var _a;
|
|
929
|
+
var rootNodes = [];
|
|
930
|
+
var currentRootNode = node.getRootNode();
|
|
931
|
+
while(!isUndefined(currentRootNode)){
|
|
932
|
+
rootNodes.push(currentRootNode);
|
|
933
|
+
currentRootNode = (_a = currentRootNode.host) === null || _a === void 0 ? void 0 : _a.getRootNode();
|
|
934
|
+
}
|
|
935
|
+
return rootNodes;
|
|
936
|
+
}
|
|
937
|
+
// Keep searching up the host tree until we find an element that is within the immediate shadow root
|
|
938
|
+
var findAncestorHostInImmediateShadowRoot = function(rootNode, targetRootNode) {
|
|
939
|
+
var host;
|
|
940
|
+
while(!isUndefined(host = rootNode.host)){
|
|
941
|
+
var thisRootNode = host.getRootNode();
|
|
942
|
+
if (thisRootNode === targetRootNode) {
|
|
943
|
+
return host;
|
|
944
|
+
}
|
|
945
|
+
rootNode = thisRootNode;
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
function fauxElementsFromPoint(context, doc, left, top) {
|
|
949
|
+
var elements = elementsFromPoint.call(doc, left, top);
|
|
950
|
+
var result = [];
|
|
951
|
+
var rootNodes = getAllRootNodes(context);
|
|
952
|
+
// Filter the elements array to only include those elements that are in this shadow root or in one of its
|
|
953
|
+
// ancestor roots. This matches Chrome and Safari's implementation (but not Firefox's, which only includes
|
|
954
|
+
// elements in the immediate shadow root: https://crbug.com/1207863#c4).
|
|
955
|
+
if (!isNull(elements)) {
|
|
956
|
+
// can be null in IE https://developer.mozilla.org/en-US/docs/Web/API/Document/elementsFromPoint#browser_compatibility
|
|
957
|
+
for(var i = 0; i < elements.length; i++){
|
|
958
|
+
var element = elements[i];
|
|
959
|
+
if (isSyntheticSlotElement(element)) {
|
|
960
|
+
continue;
|
|
961
|
+
}
|
|
962
|
+
var elementRootNode = element.getRootNode();
|
|
963
|
+
if (ArrayIndexOf.call(rootNodes, elementRootNode) !== -1) {
|
|
964
|
+
ArrayPush.call(result, element);
|
|
965
|
+
continue;
|
|
966
|
+
}
|
|
967
|
+
// In cases where the host element is not visible but its shadow descendants are, then
|
|
968
|
+
// we may get the shadow descendant instead of the host element here. (The
|
|
969
|
+
// browser doesn't know the difference in synthetic shadow DOM.)
|
|
970
|
+
// In native shadow DOM, however, elementsFromPoint would return the host but not
|
|
971
|
+
// the child. So we need to detect if this shadow element's host is accessible from
|
|
972
|
+
// the context's shadow root. Note we also need to be careful not to add the host
|
|
973
|
+
// multiple times.
|
|
974
|
+
var ancestorHost = findAncestorHostInImmediateShadowRoot(elementRootNode, rootNodes[0]);
|
|
975
|
+
if (!isUndefined(ancestorHost) && ArrayIndexOf.call(elements, ancestorHost) === -1 && ArrayIndexOf.call(result, ancestorHost) === -1) {
|
|
976
|
+
ArrayPush.call(result, ancestorHost);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return result;
|
|
981
|
+
}
|
|
1035
982
|
/*
|
|
1036
983
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1037
984
|
* All rights reserved.
|
|
@@ -1068,166 +1015,48 @@
|
|
|
1068
1015
|
writable: true,
|
|
1069
1016
|
enumerable: true,
|
|
1070
1017
|
configurable: true,
|
|
1071
|
-
value: function value(name) {
|
|
1072
|
-
if (name === "") {
|
|
1073
|
-
return null;
|
|
1074
|
-
}
|
|
1075
|
-
var items = Items.get(this);
|
|
1076
|
-
for(var i = 0, len = items.length; i < len; i++){
|
|
1077
|
-
var item = items[len];
|
|
1078
|
-
if (name === getAttribute.call(item, "id") || name === getAttribute.call(item, "name")) {
|
|
1079
|
-
return item;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
return null;
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
}, _defineProperty(_obj1, Symbol.toStringTag, {
|
|
1086
|
-
configurable: true,
|
|
1087
|
-
get: function get() {
|
|
1088
|
-
return "HTMLCollection";
|
|
1089
|
-
}
|
|
1090
|
-
}), // IE11 doesn't support Symbol.toStringTag, in which case we
|
|
1091
|
-
// provide the regular toString method.
|
|
1092
|
-
_defineProperty(_obj1, "toString", {
|
|
1093
|
-
writable: true,
|
|
1094
|
-
configurable: true,
|
|
1095
|
-
value: function value() {
|
|
1096
|
-
return "[object HTMLCollection]";
|
|
1097
|
-
}
|
|
1098
|
-
}), _obj1));
|
|
1099
|
-
// prototype inheritance dance
|
|
1100
|
-
setPrototypeOf(StaticHTMLCollection, HTMLCollection);
|
|
1101
|
-
function createStaticHTMLCollection(items) {
|
|
1102
|
-
var collection = create(StaticHTMLCollection.prototype);
|
|
1103
|
-
Items.set(collection, items);
|
|
1104
|
-
// setting static indexes
|
|
1105
|
-
forEach.call(items, function(item, index) {
|
|
1106
|
-
defineProperty(collection, index, {
|
|
1107
|
-
value: item,
|
|
1108
|
-
enumerable: true,
|
|
1109
|
-
configurable: true
|
|
1110
|
-
});
|
|
1111
|
-
});
|
|
1112
|
-
return collection;
|
|
1113
|
-
}
|
|
1114
|
-
/*
|
|
1115
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1116
|
-
* All rights reserved.
|
|
1117
|
-
* SPDX-License-Identifier: MIT
|
|
1118
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1119
|
-
*/ function getInnerHTML(node) {
|
|
1120
|
-
var s = "";
|
|
1121
|
-
var childNodes = getFilteredChildNodes(node);
|
|
1122
|
-
for(var i = 0, len = childNodes.length; i < len; i += 1){
|
|
1123
|
-
s += getOuterHTML(childNodes[i]);
|
|
1124
|
-
}
|
|
1125
|
-
return s;
|
|
1126
|
-
}
|
|
1127
|
-
/*
|
|
1128
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1129
|
-
* All rights reserved.
|
|
1130
|
-
* SPDX-License-Identifier: MIT
|
|
1131
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1132
|
-
*/ // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#escapingString
|
|
1133
|
-
var escapeAttrRegExp = /[&\u00A0"]/g;
|
|
1134
|
-
var escapeDataRegExp = /[&\u00A0<>]/g;
|
|
1135
|
-
var _prototype5 = String.prototype, replace = _prototype5.replace, toLowerCase = _prototype5.toLowerCase;
|
|
1136
|
-
function escapeReplace(c) {
|
|
1137
|
-
switch(c){
|
|
1138
|
-
case "&":
|
|
1139
|
-
return "&";
|
|
1140
|
-
case "<":
|
|
1141
|
-
return "<";
|
|
1142
|
-
case ">":
|
|
1143
|
-
return ">";
|
|
1144
|
-
case '"':
|
|
1145
|
-
return """;
|
|
1146
|
-
case "\xa0":
|
|
1147
|
-
return " ";
|
|
1148
|
-
default:
|
|
1149
|
-
return "";
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
function escapeAttr(s) {
|
|
1153
|
-
return replace.call(s, escapeAttrRegExp, escapeReplace);
|
|
1154
|
-
}
|
|
1155
|
-
function escapeData(s) {
|
|
1156
|
-
return replace.call(s, escapeDataRegExp, escapeReplace);
|
|
1157
|
-
}
|
|
1158
|
-
// http://www.whatwg.org/specs/web-apps/current-work/#void-elements
|
|
1159
|
-
var voidElements = new Set([
|
|
1160
|
-
"AREA",
|
|
1161
|
-
"BASE",
|
|
1162
|
-
"BR",
|
|
1163
|
-
"COL",
|
|
1164
|
-
"COMMAND",
|
|
1165
|
-
"EMBED",
|
|
1166
|
-
"HR",
|
|
1167
|
-
"IMG",
|
|
1168
|
-
"INPUT",
|
|
1169
|
-
"KEYGEN",
|
|
1170
|
-
"LINK",
|
|
1171
|
-
"META",
|
|
1172
|
-
"PARAM",
|
|
1173
|
-
"SOURCE",
|
|
1174
|
-
"TRACK",
|
|
1175
|
-
"WBR",
|
|
1176
|
-
]);
|
|
1177
|
-
var plaintextParents = new Set([
|
|
1178
|
-
"STYLE",
|
|
1179
|
-
"SCRIPT",
|
|
1180
|
-
"XMP",
|
|
1181
|
-
"IFRAME",
|
|
1182
|
-
"NOEMBED",
|
|
1183
|
-
"NOFRAMES",
|
|
1184
|
-
"PLAINTEXT",
|
|
1185
|
-
"NOSCRIPT",
|
|
1186
|
-
]);
|
|
1187
|
-
function getOuterHTML(node) {
|
|
1188
|
-
switch(node.nodeType){
|
|
1189
|
-
case ELEMENT_NODE:
|
|
1190
|
-
{
|
|
1191
|
-
var attrs = node.attributes;
|
|
1192
|
-
var tagName = tagNameGetter.call(node);
|
|
1193
|
-
var s = "<" + toLowerCase.call(tagName);
|
|
1194
|
-
for(var i = 0, attr; attr = attrs[i]; i++){
|
|
1195
|
-
s += " " + attr.name + '="' + escapeAttr(attr.value) + '"';
|
|
1196
|
-
}
|
|
1197
|
-
s += ">";
|
|
1198
|
-
if (voidElements.has(tagName)) {
|
|
1199
|
-
return s;
|
|
1200
|
-
}
|
|
1201
|
-
return s + getInnerHTML(node) + "</" + toLowerCase.call(tagName) + ">";
|
|
1202
|
-
}
|
|
1203
|
-
case TEXT_NODE:
|
|
1204
|
-
{
|
|
1205
|
-
var data = node.data, parentNode = node.parentNode;
|
|
1206
|
-
if (_instanceof(parentNode, Element) && plaintextParents.has(tagNameGetter.call(parentNode))) {
|
|
1207
|
-
return data;
|
|
1208
|
-
}
|
|
1209
|
-
return escapeData(data);
|
|
1210
|
-
}
|
|
1211
|
-
case CDATA_SECTION_NODE:
|
|
1212
|
-
{
|
|
1213
|
-
return "<!CDATA[[".concat(node.data, "]]>");
|
|
1214
|
-
}
|
|
1215
|
-
case PROCESSING_INSTRUCTION_NODE:
|
|
1216
|
-
{
|
|
1217
|
-
return "<?".concat(node.target, " ").concat(node.data, "?>");
|
|
1218
|
-
}
|
|
1219
|
-
case COMMENT_NODE:
|
|
1220
|
-
{
|
|
1221
|
-
return "<!--".concat(node.data, "-->");
|
|
1018
|
+
value: function value(name) {
|
|
1019
|
+
if (name === "") {
|
|
1020
|
+
return null;
|
|
1222
1021
|
}
|
|
1223
|
-
|
|
1224
|
-
{
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1022
|
+
var items = Items.get(this);
|
|
1023
|
+
for(var i = 0, len = items.length; i < len; i++){
|
|
1024
|
+
var item = items[len];
|
|
1025
|
+
if (name === getAttribute.call(item, "id") || name === getAttribute.call(item, "name")) {
|
|
1026
|
+
return item;
|
|
1027
|
+
}
|
|
1229
1028
|
}
|
|
1029
|
+
return null;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}, _defineProperty(_obj1, Symbol.toStringTag, {
|
|
1033
|
+
configurable: true,
|
|
1034
|
+
get: function get() {
|
|
1035
|
+
return "HTMLCollection";
|
|
1036
|
+
}
|
|
1037
|
+
}), // IE11 doesn't support Symbol.toStringTag, in which case we
|
|
1038
|
+
// provide the regular toString method.
|
|
1039
|
+
_defineProperty(_obj1, "toString", {
|
|
1040
|
+
writable: true,
|
|
1041
|
+
configurable: true,
|
|
1042
|
+
value: function value() {
|
|
1043
|
+
return "[object HTMLCollection]";
|
|
1230
1044
|
}
|
|
1045
|
+
}), _obj1));
|
|
1046
|
+
// prototype inheritance dance
|
|
1047
|
+
setPrototypeOf(StaticHTMLCollection, HTMLCollection);
|
|
1048
|
+
function createStaticHTMLCollection(items) {
|
|
1049
|
+
var collection = create(StaticHTMLCollection.prototype);
|
|
1050
|
+
Items.set(collection, items);
|
|
1051
|
+
// setting static indexes
|
|
1052
|
+
forEach.call(items, function(item, index) {
|
|
1053
|
+
defineProperty(collection, index, {
|
|
1054
|
+
value: item,
|
|
1055
|
+
enumerable: true,
|
|
1056
|
+
configurable: true
|
|
1057
|
+
});
|
|
1058
|
+
});
|
|
1059
|
+
return collection;
|
|
1231
1060
|
}
|
|
1232
1061
|
/**
|
|
1233
1062
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -1237,7 +1066,7 @@
|
|
|
1237
1066
|
});
|
|
1238
1067
|
}
|
|
1239
1068
|
var runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
1240
|
-
/** version: 2.13.
|
|
1069
|
+
/** version: 2.13.3 */ /*
|
|
1241
1070
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1242
1071
|
* All rights reserved.
|
|
1243
1072
|
* SPDX-License-Identifier: MIT
|
|
@@ -1611,61 +1440,232 @@
|
|
|
1611
1440
|
* All rights reserved.
|
|
1612
1441
|
* SPDX-License-Identifier: MIT
|
|
1613
1442
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1614
|
-
*/
|
|
1615
|
-
|
|
1443
|
+
*/ var EventListenerMap = new WeakMap();
|
|
1444
|
+
var ComposedPathMap = new WeakMap();
|
|
1445
|
+
function isEventListenerOrEventListenerObject(fnOrObj) {
|
|
1446
|
+
return isFunction(fnOrObj) || isObject(fnOrObj) && !isNull(fnOrObj) && isFunction(fnOrObj.handleEvent);
|
|
1447
|
+
}
|
|
1448
|
+
function shouldInvokeListener(event, target, currentTarget) {
|
|
1449
|
+
// Subsequent logic assumes that `currentTarget` must be contained in the composed path for the listener to be
|
|
1450
|
+
// invoked, but this is not always the case. `composedPath()` will sometimes return an empty array, even when the
|
|
1451
|
+
// listener should be invoked (e.g., a disconnected instance of EventTarget, an instance of XMLHttpRequest, etc).
|
|
1452
|
+
if (target === currentTarget) {
|
|
1453
|
+
return true;
|
|
1454
|
+
}
|
|
1455
|
+
var composedPath1 = ComposedPathMap.get(event);
|
|
1456
|
+
if (isUndefined(composedPath1)) {
|
|
1457
|
+
composedPath1 = event.composedPath();
|
|
1458
|
+
ComposedPathMap.set(event, composedPath1);
|
|
1459
|
+
}
|
|
1460
|
+
return composedPath1.includes(currentTarget);
|
|
1461
|
+
}
|
|
1462
|
+
function getEventListenerWrapper(fnOrObj) {
|
|
1463
|
+
if (!isEventListenerOrEventListenerObject(fnOrObj)) {
|
|
1464
|
+
return fnOrObj;
|
|
1465
|
+
}
|
|
1466
|
+
var wrapperFn = EventListenerMap.get(fnOrObj);
|
|
1467
|
+
if (isUndefined(wrapperFn)) {
|
|
1468
|
+
wrapperFn = function wrapperFn(event) {
|
|
1469
|
+
// This function is invoked from an event listener and currentTarget is always defined.
|
|
1470
|
+
var currentTarget = eventCurrentTargetGetter.call(event);
|
|
1471
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1472
|
+
assert.invariant(isFalse(isSyntheticShadowHost(currentTarget)), "This routine should not be used to wrap event listeners for host elements and shadow roots.");
|
|
1473
|
+
}
|
|
1474
|
+
var actualTarget = getActualTarget(event);
|
|
1475
|
+
if (!shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
return isFunction(fnOrObj) ? fnOrObj.call(this, event) : fnOrObj.handleEvent && fnOrObj.handleEvent(event);
|
|
1479
|
+
};
|
|
1480
|
+
EventListenerMap.set(fnOrObj, wrapperFn);
|
|
1481
|
+
}
|
|
1482
|
+
return wrapperFn;
|
|
1483
|
+
}
|
|
1484
|
+
/*
|
|
1485
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
1486
|
+
* All rights reserved.
|
|
1487
|
+
* SPDX-License-Identifier: MIT
|
|
1488
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1489
|
+
*/ var eventToContextMap = new WeakMap();
|
|
1490
|
+
var customElementToWrappedListeners = new WeakMap();
|
|
1491
|
+
function getEventMap(elm) {
|
|
1492
|
+
var listenerInfo = customElementToWrappedListeners.get(elm);
|
|
1493
|
+
if (isUndefined(listenerInfo)) {
|
|
1494
|
+
listenerInfo = create(null);
|
|
1495
|
+
customElementToWrappedListeners.set(elm, listenerInfo);
|
|
1496
|
+
}
|
|
1497
|
+
return listenerInfo;
|
|
1498
|
+
}
|
|
1499
|
+
/**
|
|
1500
|
+
* Events dispatched on shadow roots actually end up being dispatched on their hosts. This means that the event.target
|
|
1501
|
+
* property of events dispatched on shadow roots always resolve to their host. This function understands this
|
|
1502
|
+
* abstraction and properly returns a reference to the shadow root when appropriate.
|
|
1503
|
+
*/ function getActualTarget(event) {
|
|
1616
1504
|
var _a;
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1505
|
+
return (_a = eventToShadowRootMap.get(event)) !== null && _a !== void 0 ? _a : eventTargetGetter.call(event);
|
|
1506
|
+
}
|
|
1507
|
+
var shadowRootEventListenerMap = new WeakMap();
|
|
1508
|
+
function getWrappedShadowRootListener(listener) {
|
|
1509
|
+
if (!isFunction(listener)) {
|
|
1510
|
+
throw new TypeError(); // avoiding problems with non-valid listeners
|
|
1622
1511
|
}
|
|
1623
|
-
|
|
1512
|
+
var shadowRootWrappedListener = shadowRootEventListenerMap.get(listener);
|
|
1513
|
+
if (isUndefined(shadowRootWrappedListener)) {
|
|
1514
|
+
shadowRootWrappedListener = function shadowRootWrappedListener(event) {
|
|
1515
|
+
// currentTarget is always defined inside an event listener
|
|
1516
|
+
var currentTarget = eventCurrentTargetGetter.call(event);
|
|
1517
|
+
// If currentTarget is not an instance of a native shadow root then we're dealing with a
|
|
1518
|
+
// host element whose synthetic shadow root must be accessed via getShadowRoot().
|
|
1519
|
+
if (!isInstanceOfNativeShadowRoot(currentTarget)) {
|
|
1520
|
+
currentTarget = getShadowRoot(currentTarget);
|
|
1521
|
+
}
|
|
1522
|
+
var actualTarget = getActualTarget(event);
|
|
1523
|
+
if (shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
1524
|
+
listener.call(currentTarget, event);
|
|
1525
|
+
}
|
|
1526
|
+
};
|
|
1527
|
+
shadowRootWrappedListener.placement = 1 /* SHADOW_ROOT_LISTENER */ ;
|
|
1528
|
+
shadowRootEventListenerMap.set(listener, shadowRootWrappedListener);
|
|
1529
|
+
}
|
|
1530
|
+
return shadowRootWrappedListener;
|
|
1624
1531
|
}
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1532
|
+
var customElementEventListenerMap = new WeakMap();
|
|
1533
|
+
function getWrappedCustomElementListener(listener) {
|
|
1534
|
+
if (!isFunction(listener)) {
|
|
1535
|
+
throw new TypeError(); // avoiding problems with non-valid listeners
|
|
1536
|
+
}
|
|
1537
|
+
var customElementWrappedListener = customElementEventListenerMap.get(listener);
|
|
1538
|
+
if (isUndefined(customElementWrappedListener)) {
|
|
1539
|
+
customElementWrappedListener = function customElementWrappedListener(event) {
|
|
1540
|
+
// currentTarget is always defined inside an event listener
|
|
1541
|
+
var currentTarget = eventCurrentTargetGetter.call(event);
|
|
1542
|
+
var actualTarget = getActualTarget(event);
|
|
1543
|
+
if (shouldInvokeListener(event, actualTarget, currentTarget)) {
|
|
1544
|
+
listener.call(currentTarget, event);
|
|
1545
|
+
}
|
|
1546
|
+
};
|
|
1547
|
+
customElementWrappedListener.placement = 0 /* CUSTOM_ELEMENT_LISTENER */ ;
|
|
1548
|
+
customElementEventListenerMap.set(listener, customElementWrappedListener);
|
|
1549
|
+
}
|
|
1550
|
+
return customElementWrappedListener;
|
|
1551
|
+
}
|
|
1552
|
+
function domListener(evt) {
|
|
1553
|
+
var invokeListenersByPlacement = function invokeListenersByPlacement(placement) {
|
|
1554
|
+
forEach.call(bookkeeping, function(listener) {
|
|
1555
|
+
if (isFalse(immediatePropagationStopped) && listener.placement === placement) {
|
|
1556
|
+
// making sure that the listener was not removed from the original listener queue
|
|
1557
|
+
if (ArrayIndexOf.call(listeners, listener) !== -1) {
|
|
1558
|
+
// all handlers on the custom element should be called with undefined 'this'
|
|
1559
|
+
listener.call(undefined, evt);
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
});
|
|
1563
|
+
};
|
|
1564
|
+
var immediatePropagationStopped = false;
|
|
1565
|
+
var propagationStopped = false;
|
|
1566
|
+
var type = evt.type, stopImmediatePropagation = evt.stopImmediatePropagation, stopPropagation = evt.stopPropagation;
|
|
1567
|
+
// currentTarget is always defined
|
|
1568
|
+
var currentTarget = eventCurrentTargetGetter.call(evt);
|
|
1569
|
+
var listenerMap = getEventMap(currentTarget);
|
|
1570
|
+
var listeners = listenerMap[type]; // it must have listeners at this point
|
|
1571
|
+
defineProperty(evt, "stopImmediatePropagation", {
|
|
1572
|
+
value: function value() {
|
|
1573
|
+
immediatePropagationStopped = true;
|
|
1574
|
+
stopImmediatePropagation.call(evt);
|
|
1575
|
+
},
|
|
1576
|
+
writable: true,
|
|
1577
|
+
enumerable: true,
|
|
1578
|
+
configurable: true
|
|
1579
|
+
});
|
|
1580
|
+
defineProperty(evt, "stopPropagation", {
|
|
1581
|
+
value: function value() {
|
|
1582
|
+
propagationStopped = true;
|
|
1583
|
+
stopPropagation.call(evt);
|
|
1584
|
+
},
|
|
1585
|
+
writable: true,
|
|
1586
|
+
enumerable: true,
|
|
1587
|
+
configurable: true
|
|
1588
|
+
});
|
|
1589
|
+
// in case a listener adds or removes other listeners during invocation
|
|
1590
|
+
var bookkeeping = ArraySlice.call(listeners);
|
|
1591
|
+
eventToContextMap.set(evt, 1 /* SHADOW_ROOT_LISTENER */ );
|
|
1592
|
+
invokeListenersByPlacement(1 /* SHADOW_ROOT_LISTENER */ );
|
|
1593
|
+
if (isFalse(immediatePropagationStopped) && isFalse(propagationStopped)) {
|
|
1594
|
+
// doing the second iteration only if the first one didn't interrupt the event propagation
|
|
1595
|
+
eventToContextMap.set(evt, 0 /* CUSTOM_ELEMENT_LISTENER */ );
|
|
1596
|
+
invokeListenersByPlacement(0 /* CUSTOM_ELEMENT_LISTENER */ );
|
|
1597
|
+
}
|
|
1598
|
+
eventToContextMap.set(evt, 2 /* UNKNOWN_LISTENER */ );
|
|
1599
|
+
}
|
|
1600
|
+
function attachDOMListener(elm, type, wrappedListener) {
|
|
1601
|
+
var listenerMap = getEventMap(elm);
|
|
1602
|
+
var cmpEventHandlers = listenerMap[type];
|
|
1603
|
+
if (isUndefined(cmpEventHandlers)) {
|
|
1604
|
+
cmpEventHandlers = listenerMap[type] = [];
|
|
1605
|
+
}
|
|
1606
|
+
// Prevent identical listeners from subscribing to the same event type.
|
|
1607
|
+
// TODO [#1824]: Options will also play a factor when we introduce support for them (#1824).
|
|
1608
|
+
if (ArrayIndexOf.call(cmpEventHandlers, wrappedListener) !== -1) {
|
|
1609
|
+
return;
|
|
1610
|
+
}
|
|
1611
|
+
// only add to DOM if there is no other listener on the same placement yet
|
|
1612
|
+
if (cmpEventHandlers.length === 0) {
|
|
1613
|
+
// super.addEventListener() - this will not work on
|
|
1614
|
+
addEventListener.call(elm, type, domListener);
|
|
1615
|
+
}
|
|
1616
|
+
ArrayPush.call(cmpEventHandlers, wrappedListener);
|
|
1617
|
+
}
|
|
1618
|
+
function detachDOMListener(elm, type, wrappedListener) {
|
|
1619
|
+
var listenerMap = getEventMap(elm);
|
|
1620
|
+
var p;
|
|
1621
|
+
var listeners;
|
|
1622
|
+
if (!isUndefined(listeners = listenerMap[type]) && (p = ArrayIndexOf.call(listeners, wrappedListener)) !== -1) {
|
|
1623
|
+
ArraySplice.call(listeners, p, 1);
|
|
1624
|
+
// only remove from DOM if there is no other listener on the same placement
|
|
1625
|
+
if (listeners.length === 0) {
|
|
1626
|
+
removeEventListener.call(elm, type, domListener);
|
|
1632
1627
|
}
|
|
1633
|
-
rootNode = thisRootNode;
|
|
1634
1628
|
}
|
|
1635
|
-
}
|
|
1636
|
-
function
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
//
|
|
1643
|
-
if (
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
// the child. So we need to detect if this shadow element's host is accessible from
|
|
1660
|
-
// the context's shadow root. Note we also need to be careful not to add the host
|
|
1661
|
-
// multiple times.
|
|
1662
|
-
var ancestorHost = findAncestorHostInImmediateShadowRoot(elementRootNode, rootNodes[0]);
|
|
1663
|
-
if (!isUndefined(ancestorHost) && ArrayIndexOf.call(elements, ancestorHost) === -1 && ArrayIndexOf.call(result, ancestorHost) === -1) {
|
|
1664
|
-
ArrayPush.call(result, ancestorHost);
|
|
1665
|
-
}
|
|
1629
|
+
}
|
|
1630
|
+
function addCustomElementEventListener(type, listener, _options) {
|
|
1631
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1632
|
+
if (!isFunction(listener)) {
|
|
1633
|
+
throw new TypeError("Invalid second argument for Element.addEventListener() in ".concat(toString(this), ' for event "').concat(type, '". Expected an EventListener but received ').concat(listener, "."));
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
// TODO [#1824]: Lift this restriction on the option parameter
|
|
1637
|
+
if (isFunction(listener)) {
|
|
1638
|
+
var wrappedListener = getWrappedCustomElementListener(listener);
|
|
1639
|
+
attachDOMListener(this, type, wrappedListener);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
function removeCustomElementEventListener(type, listener, _options) {
|
|
1643
|
+
// TODO [#1824]: Lift this restriction on the option parameter
|
|
1644
|
+
if (isFunction(listener)) {
|
|
1645
|
+
var wrappedListener = getWrappedCustomElementListener(listener);
|
|
1646
|
+
detachDOMListener(this, type, wrappedListener);
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
function addShadowRootEventListener(sr, type, listener, _options) {
|
|
1650
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1651
|
+
if (!isFunction(listener)) {
|
|
1652
|
+
throw new TypeError("Invalid second argument for ShadowRoot.addEventListener() in ".concat(toString(sr), ' for event "').concat(type, '". Expected an EventListener but received ').concat(listener, "."));
|
|
1666
1653
|
}
|
|
1667
1654
|
}
|
|
1668
|
-
|
|
1655
|
+
// TODO [#1824]: Lift this restriction on the option parameter
|
|
1656
|
+
if (isFunction(listener)) {
|
|
1657
|
+
var elm = getHost(sr);
|
|
1658
|
+
var wrappedListener = getWrappedShadowRootListener(listener);
|
|
1659
|
+
attachDOMListener(elm, type, wrappedListener);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
function removeShadowRootEventListener(sr, type, listener, _options) {
|
|
1663
|
+
// TODO [#1824]: Lift this restriction on the option parameter
|
|
1664
|
+
if (isFunction(listener)) {
|
|
1665
|
+
var elm = getHost(sr);
|
|
1666
|
+
var wrappedListener = getWrappedShadowRootListener(listener);
|
|
1667
|
+
detachDOMListener(elm, type, wrappedListener);
|
|
1668
|
+
}
|
|
1669
1669
|
}
|
|
1670
1670
|
/*
|
|
1671
1671
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3750,52 +3750,236 @@
|
|
|
3750
3750
|
enumerable: true,
|
|
3751
3751
|
configurable: true
|
|
3752
3752
|
}
|
|
3753
|
-
}); // The following APIs are used directly by Jest internally so we avoid patching them during testing.
|
|
3754
|
-
if (process.env.NODE_ENV !== "test") {
|
|
3755
|
-
defineProperties(Element.prototype, {
|
|
3756
|
-
getElementsByClassName: {
|
|
3757
|
-
value: function value() {
|
|
3758
|
-
var elements = arrayFromCollection(getElementsByClassName$1.apply(this, ArraySlice.call(arguments)));
|
|
3759
|
-
if (!runtimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
|
|
3760
|
-
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
3761
|
-
}
|
|
3762
|
-
var filteredResults = getFilteredArrayOfNodes(this, elements, 1);
|
|
3763
|
-
return createStaticHTMLCollection(filteredResults);
|
|
3764
|
-
},
|
|
3765
|
-
writable: true,
|
|
3766
|
-
enumerable: true,
|
|
3767
|
-
configurable: true
|
|
3768
|
-
},
|
|
3769
|
-
getElementsByTagName: {
|
|
3770
|
-
value: function value() {
|
|
3771
|
-
var elements = arrayFromCollection(getElementsByTagName$1.apply(this, ArraySlice.call(arguments)));
|
|
3772
|
-
if (!runtimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
|
|
3773
|
-
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
3774
|
-
}
|
|
3775
|
-
var filteredResults = getFilteredArrayOfNodes(this, elements, 1);
|
|
3776
|
-
return createStaticHTMLCollection(filteredResults);
|
|
3777
|
-
},
|
|
3778
|
-
writable: true,
|
|
3779
|
-
enumerable: true,
|
|
3780
|
-
configurable: true
|
|
3781
|
-
},
|
|
3782
|
-
getElementsByTagNameNS: {
|
|
3783
|
-
value: function value() {
|
|
3784
|
-
var elements = arrayFromCollection(getElementsByTagNameNS$1.apply(this, ArraySlice.call(arguments)));
|
|
3785
|
-
if (!runtimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
|
|
3786
|
-
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
3753
|
+
}); // The following APIs are used directly by Jest internally so we avoid patching them during testing.
|
|
3754
|
+
if (process.env.NODE_ENV !== "test") {
|
|
3755
|
+
defineProperties(Element.prototype, {
|
|
3756
|
+
getElementsByClassName: {
|
|
3757
|
+
value: function value() {
|
|
3758
|
+
var elements = arrayFromCollection(getElementsByClassName$1.apply(this, ArraySlice.call(arguments)));
|
|
3759
|
+
if (!runtimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
|
|
3760
|
+
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
3761
|
+
}
|
|
3762
|
+
var filteredResults = getFilteredArrayOfNodes(this, elements, 1);
|
|
3763
|
+
return createStaticHTMLCollection(filteredResults);
|
|
3764
|
+
},
|
|
3765
|
+
writable: true,
|
|
3766
|
+
enumerable: true,
|
|
3767
|
+
configurable: true
|
|
3768
|
+
},
|
|
3769
|
+
getElementsByTagName: {
|
|
3770
|
+
value: function value() {
|
|
3771
|
+
var elements = arrayFromCollection(getElementsByTagName$1.apply(this, ArraySlice.call(arguments)));
|
|
3772
|
+
if (!runtimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
|
|
3773
|
+
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
3774
|
+
}
|
|
3775
|
+
var filteredResults = getFilteredArrayOfNodes(this, elements, 1);
|
|
3776
|
+
return createStaticHTMLCollection(filteredResults);
|
|
3777
|
+
},
|
|
3778
|
+
writable: true,
|
|
3779
|
+
enumerable: true,
|
|
3780
|
+
configurable: true
|
|
3781
|
+
},
|
|
3782
|
+
getElementsByTagNameNS: {
|
|
3783
|
+
value: function value() {
|
|
3784
|
+
var elements = arrayFromCollection(getElementsByTagNameNS$1.apply(this, ArraySlice.call(arguments)));
|
|
3785
|
+
if (!runtimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
|
|
3786
|
+
return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
|
|
3787
|
+
}
|
|
3788
|
+
var filteredResults = getFilteredArrayOfNodes(this, elements, 1);
|
|
3789
|
+
return createStaticHTMLCollection(filteredResults);
|
|
3790
|
+
},
|
|
3791
|
+
writable: true,
|
|
3792
|
+
enumerable: true,
|
|
3793
|
+
configurable: true
|
|
3794
|
+
}
|
|
3795
|
+
});
|
|
3796
|
+
} // IE11 extra patches for wrong prototypes
|
|
3797
|
+
if (hasOwnProperty.call(HTMLElement.prototype, "getElementsByClassName")) {
|
|
3798
|
+
defineProperty(HTMLElement.prototype, "getElementsByClassName", getOwnPropertyDescriptor(Element.prototype, "getElementsByClassName"));
|
|
3799
|
+
}
|
|
3800
|
+
/*
|
|
3801
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3802
|
+
* All rights reserved.
|
|
3803
|
+
* SPDX-License-Identifier: MIT
|
|
3804
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3805
|
+
*/ function getElementComputedStyle(element) {
|
|
3806
|
+
var win = getOwnerWindow(element);
|
|
3807
|
+
return windowGetComputedStyle.call(win, element);
|
|
3808
|
+
}
|
|
3809
|
+
function getWindowSelection(node) {
|
|
3810
|
+
var win = getOwnerWindow(node);
|
|
3811
|
+
return windowGetSelection.call(win);
|
|
3812
|
+
}
|
|
3813
|
+
function nodeIsBeingRendered(nodeComputedStyle) {
|
|
3814
|
+
return nodeComputedStyle.visibility === "visible" && nodeComputedStyle.display !== "none";
|
|
3815
|
+
}
|
|
3816
|
+
function getSelectionState(element) {
|
|
3817
|
+
var win = getOwnerWindow(element);
|
|
3818
|
+
var selection = getWindowSelection(element);
|
|
3819
|
+
if (selection === null) {
|
|
3820
|
+
return null;
|
|
3821
|
+
}
|
|
3822
|
+
var ranges = [];
|
|
3823
|
+
for(var i = 0; i < selection.rangeCount; i++){
|
|
3824
|
+
ranges.push(selection.getRangeAt(i));
|
|
3825
|
+
}
|
|
3826
|
+
var state = {
|
|
3827
|
+
element: element,
|
|
3828
|
+
onselect: win.onselect,
|
|
3829
|
+
onselectstart: win.onselectstart,
|
|
3830
|
+
onselectionchange: win.onselectionchange,
|
|
3831
|
+
ranges: ranges
|
|
3832
|
+
};
|
|
3833
|
+
win.onselect = null;
|
|
3834
|
+
win.onselectstart = null;
|
|
3835
|
+
win.onselectionchange = null;
|
|
3836
|
+
return state;
|
|
3837
|
+
}
|
|
3838
|
+
function restoreSelectionState(state) {
|
|
3839
|
+
if (state === null) {
|
|
3840
|
+
return;
|
|
3841
|
+
}
|
|
3842
|
+
var element = state.element, onselect = state.onselect, onselectstart = state.onselectstart, onselectionchange = state.onselectionchange, ranges = state.ranges;
|
|
3843
|
+
var win = getOwnerWindow(element);
|
|
3844
|
+
var selection = getWindowSelection(element);
|
|
3845
|
+
selection.removeAllRanges();
|
|
3846
|
+
for(var i = 0; i < ranges.length; i++){
|
|
3847
|
+
selection.addRange(ranges[i]);
|
|
3848
|
+
}
|
|
3849
|
+
win.onselect = onselect;
|
|
3850
|
+
win.onselectstart = onselectstart;
|
|
3851
|
+
win.onselectionchange = onselectionchange;
|
|
3852
|
+
}
|
|
3853
|
+
/**
|
|
3854
|
+
* Gets the "innerText" of a text node using the Selection API
|
|
3855
|
+
*
|
|
3856
|
+
* NOTE: For performance reasons, since this function will be called multiple times while calculating the innerText of
|
|
3857
|
+
* an element, it does not restore the current selection.
|
|
3858
|
+
*/ function getTextNodeInnerText(textNode) {
|
|
3859
|
+
var selection = getWindowSelection(textNode);
|
|
3860
|
+
if (selection === null) {
|
|
3861
|
+
return textNode.textContent || "";
|
|
3862
|
+
}
|
|
3863
|
+
var range = document.createRange();
|
|
3864
|
+
range.selectNodeContents(textNode);
|
|
3865
|
+
var domRect = range.getBoundingClientRect();
|
|
3866
|
+
if (domRect.height <= 0 || domRect.width <= 0) {
|
|
3867
|
+
// the text node is not rendered
|
|
3868
|
+
return "";
|
|
3869
|
+
}
|
|
3870
|
+
// Needed to remove non rendered characters from the text node.
|
|
3871
|
+
selection.removeAllRanges();
|
|
3872
|
+
selection.addRange(range);
|
|
3873
|
+
var selectionText = selection.toString();
|
|
3874
|
+
// The textNode is visible, but it may not be selectable. When the text is not selectable,
|
|
3875
|
+
// textContent is the nearest approximation to innerText.
|
|
3876
|
+
return selectionText ? selectionText : textNode.textContent || "";
|
|
3877
|
+
}
|
|
3878
|
+
var nodeIsElement = function(node) {
|
|
3879
|
+
return node.nodeType === ELEMENT_NODE;
|
|
3880
|
+
};
|
|
3881
|
+
var nodeIsText = function(node) {
|
|
3882
|
+
return node.nodeType === TEXT_NODE;
|
|
3883
|
+
};
|
|
3884
|
+
/**
|
|
3885
|
+
* Spec: https://html.spec.whatwg.org/multipage/dom.html#inner-text-collection-steps
|
|
3886
|
+
* One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1132
|
|
3887
|
+
*/ function innerTextCollectionSteps(node) {
|
|
3888
|
+
var items = [];
|
|
3889
|
+
if (nodeIsElement(node)) {
|
|
3890
|
+
var tagName = node.tagName;
|
|
3891
|
+
var computedStyle = getElementComputedStyle(node);
|
|
3892
|
+
if (tagName === "OPTION") {
|
|
3893
|
+
// For options, is hard to get the "rendered" text, let's use the original getter.
|
|
3894
|
+
return [
|
|
3895
|
+
1,
|
|
3896
|
+
innerTextGetter.call(node),
|
|
3897
|
+
1
|
|
3898
|
+
];
|
|
3899
|
+
} else if (tagName === "TEXTAREA") {
|
|
3900
|
+
return [];
|
|
3901
|
+
} else {
|
|
3902
|
+
var childNodes = node.childNodes;
|
|
3903
|
+
for(var i = 0, n = childNodes.length; i < n; i++){
|
|
3904
|
+
ArrayPush.apply(items, innerTextCollectionSteps(childNodes[i]));
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
if (!nodeIsBeingRendered(computedStyle)) {
|
|
3908
|
+
if (tagName === "SELECT" || tagName === "DATALIST") {
|
|
3909
|
+
// the select is either: .visibility != 'visible' or .display === hidden, therefore this select should
|
|
3910
|
+
// not display any value.
|
|
3911
|
+
return [];
|
|
3912
|
+
}
|
|
3913
|
+
return items;
|
|
3914
|
+
}
|
|
3915
|
+
if (tagName === "BR") {
|
|
3916
|
+
items.push("\n" /* line feed */ );
|
|
3917
|
+
}
|
|
3918
|
+
var display = computedStyle.display;
|
|
3919
|
+
if (display === "table-cell") {
|
|
3920
|
+
// omitting case: and node's CSS box is not the last 'table-cell' box of its enclosing 'table-row' box
|
|
3921
|
+
items.push(" " /* tab */ );
|
|
3922
|
+
}
|
|
3923
|
+
if (display === "table-row") {
|
|
3924
|
+
// omitting case: and node's CSS box is not the last 'table-row' box of the nearest ancestor 'table' box
|
|
3925
|
+
items.push("\n" /* line feed */ );
|
|
3926
|
+
}
|
|
3927
|
+
if (tagName === "P") {
|
|
3928
|
+
items.unshift(2);
|
|
3929
|
+
items.push(2);
|
|
3930
|
+
}
|
|
3931
|
+
if (display === "block" || display === "table-caption" || display === "flex" || display === "table") {
|
|
3932
|
+
items.unshift(1);
|
|
3933
|
+
items.push(1);
|
|
3934
|
+
}
|
|
3935
|
+
} else if (nodeIsText(node)) {
|
|
3936
|
+
items.push(getTextNodeInnerText(node));
|
|
3937
|
+
}
|
|
3938
|
+
return items;
|
|
3939
|
+
}
|
|
3940
|
+
/**
|
|
3941
|
+
* InnerText getter spec: https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute
|
|
3942
|
+
*
|
|
3943
|
+
* One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1087
|
|
3944
|
+
*/ function getInnerText(element) {
|
|
3945
|
+
var thisComputedStyle = getElementComputedStyle(element);
|
|
3946
|
+
if (!nodeIsBeingRendered(thisComputedStyle)) {
|
|
3947
|
+
return getTextContent(element) || "";
|
|
3948
|
+
}
|
|
3949
|
+
var selectionState = getSelectionState(element);
|
|
3950
|
+
var results = [];
|
|
3951
|
+
var childNodes = element.childNodes;
|
|
3952
|
+
for(var i = 0, n = childNodes.length; i < n; i++){
|
|
3953
|
+
ArrayPush.apply(results, innerTextCollectionSteps(childNodes[i]));
|
|
3954
|
+
}
|
|
3955
|
+
restoreSelectionState(selectionState);
|
|
3956
|
+
var elementInnerText = "";
|
|
3957
|
+
var maxReqLineBreakCount = 0;
|
|
3958
|
+
for(var i1 = 0, n1 = results.length; i1 < n1; i1++){
|
|
3959
|
+
var item = results[i1];
|
|
3960
|
+
if (typeof item === "string") {
|
|
3961
|
+
if (maxReqLineBreakCount > 0) {
|
|
3962
|
+
for(var j = 0; j < maxReqLineBreakCount; j++){
|
|
3963
|
+
elementInnerText += "\n";
|
|
3787
3964
|
}
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3965
|
+
maxReqLineBreakCount = 0;
|
|
3966
|
+
}
|
|
3967
|
+
if (item.length > 0) {
|
|
3968
|
+
elementInnerText += item;
|
|
3969
|
+
}
|
|
3970
|
+
} else {
|
|
3971
|
+
if (elementInnerText.length == 0) {
|
|
3972
|
+
continue;
|
|
3973
|
+
}
|
|
3974
|
+
// Store the count if it's the max of this run,
|
|
3975
|
+
// but it may be ignored if no text item is found afterwards,
|
|
3976
|
+
// which means that these are consecutive line breaks at the end.
|
|
3977
|
+
if (item > maxReqLineBreakCount) {
|
|
3978
|
+
maxReqLineBreakCount = item;
|
|
3979
|
+
}
|
|
3794
3980
|
}
|
|
3795
|
-
}
|
|
3796
|
-
|
|
3797
|
-
if (hasOwnProperty.call(HTMLElement.prototype, "getElementsByClassName")) {
|
|
3798
|
-
defineProperty(HTMLElement.prototype, "getElementsByClassName", getOwnPropertyDescriptor(Element.prototype, "getElementsByClassName"));
|
|
3981
|
+
}
|
|
3982
|
+
return elementInnerText;
|
|
3799
3983
|
}
|
|
3800
3984
|
/*
|
|
3801
3985
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4121,190 +4305,6 @@
|
|
|
4121
4305
|
function ignoreFocusIn(elm) {
|
|
4122
4306
|
removeEventListener.call(elm, "focusin", skipShadowHandler, true);
|
|
4123
4307
|
}
|
|
4124
|
-
/*
|
|
4125
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4126
|
-
* All rights reserved.
|
|
4127
|
-
* SPDX-License-Identifier: MIT
|
|
4128
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4129
|
-
*/ function getElementComputedStyle(element) {
|
|
4130
|
-
var win = getOwnerWindow(element);
|
|
4131
|
-
return windowGetComputedStyle.call(win, element);
|
|
4132
|
-
}
|
|
4133
|
-
function getWindowSelection(node) {
|
|
4134
|
-
var win = getOwnerWindow(node);
|
|
4135
|
-
return windowGetSelection.call(win);
|
|
4136
|
-
}
|
|
4137
|
-
function nodeIsBeingRendered(nodeComputedStyle) {
|
|
4138
|
-
return nodeComputedStyle.visibility === "visible" && nodeComputedStyle.display !== "none";
|
|
4139
|
-
}
|
|
4140
|
-
function getSelectionState(element) {
|
|
4141
|
-
var win = getOwnerWindow(element);
|
|
4142
|
-
var selection = getWindowSelection(element);
|
|
4143
|
-
if (selection === null) {
|
|
4144
|
-
return null;
|
|
4145
|
-
}
|
|
4146
|
-
var ranges = [];
|
|
4147
|
-
for(var i = 0; i < selection.rangeCount; i++){
|
|
4148
|
-
ranges.push(selection.getRangeAt(i));
|
|
4149
|
-
}
|
|
4150
|
-
var state = {
|
|
4151
|
-
element: element,
|
|
4152
|
-
onselect: win.onselect,
|
|
4153
|
-
onselectstart: win.onselectstart,
|
|
4154
|
-
onselectionchange: win.onselectionchange,
|
|
4155
|
-
ranges: ranges
|
|
4156
|
-
};
|
|
4157
|
-
win.onselect = null;
|
|
4158
|
-
win.onselectstart = null;
|
|
4159
|
-
win.onselectionchange = null;
|
|
4160
|
-
return state;
|
|
4161
|
-
}
|
|
4162
|
-
function restoreSelectionState(state) {
|
|
4163
|
-
if (state === null) {
|
|
4164
|
-
return;
|
|
4165
|
-
}
|
|
4166
|
-
var element = state.element, onselect = state.onselect, onselectstart = state.onselectstart, onselectionchange = state.onselectionchange, ranges = state.ranges;
|
|
4167
|
-
var win = getOwnerWindow(element);
|
|
4168
|
-
var selection = getWindowSelection(element);
|
|
4169
|
-
selection.removeAllRanges();
|
|
4170
|
-
for(var i = 0; i < ranges.length; i++){
|
|
4171
|
-
selection.addRange(ranges[i]);
|
|
4172
|
-
}
|
|
4173
|
-
win.onselect = onselect;
|
|
4174
|
-
win.onselectstart = onselectstart;
|
|
4175
|
-
win.onselectionchange = onselectionchange;
|
|
4176
|
-
}
|
|
4177
|
-
/**
|
|
4178
|
-
* Gets the "innerText" of a text node using the Selection API
|
|
4179
|
-
*
|
|
4180
|
-
* NOTE: For performance reasons, since this function will be called multiple times while calculating the innerText of
|
|
4181
|
-
* an element, it does not restore the current selection.
|
|
4182
|
-
*/ function getTextNodeInnerText(textNode) {
|
|
4183
|
-
var selection = getWindowSelection(textNode);
|
|
4184
|
-
if (selection === null) {
|
|
4185
|
-
return textNode.textContent || "";
|
|
4186
|
-
}
|
|
4187
|
-
var range = document.createRange();
|
|
4188
|
-
range.selectNodeContents(textNode);
|
|
4189
|
-
var domRect = range.getBoundingClientRect();
|
|
4190
|
-
if (domRect.height <= 0 || domRect.width <= 0) {
|
|
4191
|
-
// the text node is not rendered
|
|
4192
|
-
return "";
|
|
4193
|
-
}
|
|
4194
|
-
// Needed to remove non rendered characters from the text node.
|
|
4195
|
-
selection.removeAllRanges();
|
|
4196
|
-
selection.addRange(range);
|
|
4197
|
-
var selectionText = selection.toString();
|
|
4198
|
-
// The textNode is visible, but it may not be selectable. When the text is not selectable,
|
|
4199
|
-
// textContent is the nearest approximation to innerText.
|
|
4200
|
-
return selectionText ? selectionText : textNode.textContent || "";
|
|
4201
|
-
}
|
|
4202
|
-
var nodeIsElement = function(node) {
|
|
4203
|
-
return node.nodeType === ELEMENT_NODE;
|
|
4204
|
-
};
|
|
4205
|
-
var nodeIsText = function(node) {
|
|
4206
|
-
return node.nodeType === TEXT_NODE;
|
|
4207
|
-
};
|
|
4208
|
-
/**
|
|
4209
|
-
* Spec: https://html.spec.whatwg.org/multipage/dom.html#inner-text-collection-steps
|
|
4210
|
-
* One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1132
|
|
4211
|
-
*/ function innerTextCollectionSteps(node) {
|
|
4212
|
-
var items = [];
|
|
4213
|
-
if (nodeIsElement(node)) {
|
|
4214
|
-
var tagName = node.tagName;
|
|
4215
|
-
var computedStyle = getElementComputedStyle(node);
|
|
4216
|
-
if (tagName === "OPTION") {
|
|
4217
|
-
// For options, is hard to get the "rendered" text, let's use the original getter.
|
|
4218
|
-
return [
|
|
4219
|
-
1,
|
|
4220
|
-
innerTextGetter.call(node),
|
|
4221
|
-
1
|
|
4222
|
-
];
|
|
4223
|
-
} else if (tagName === "TEXTAREA") {
|
|
4224
|
-
return [];
|
|
4225
|
-
} else {
|
|
4226
|
-
var childNodes = node.childNodes;
|
|
4227
|
-
for(var i = 0, n = childNodes.length; i < n; i++){
|
|
4228
|
-
ArrayPush.apply(items, innerTextCollectionSteps(childNodes[i]));
|
|
4229
|
-
}
|
|
4230
|
-
}
|
|
4231
|
-
if (!nodeIsBeingRendered(computedStyle)) {
|
|
4232
|
-
if (tagName === "SELECT" || tagName === "DATALIST") {
|
|
4233
|
-
// the select is either: .visibility != 'visible' or .display === hidden, therefore this select should
|
|
4234
|
-
// not display any value.
|
|
4235
|
-
return [];
|
|
4236
|
-
}
|
|
4237
|
-
return items;
|
|
4238
|
-
}
|
|
4239
|
-
if (tagName === "BR") {
|
|
4240
|
-
items.push("\n" /* line feed */ );
|
|
4241
|
-
}
|
|
4242
|
-
var display = computedStyle.display;
|
|
4243
|
-
if (display === "table-cell") {
|
|
4244
|
-
// omitting case: and node's CSS box is not the last 'table-cell' box of its enclosing 'table-row' box
|
|
4245
|
-
items.push(" " /* tab */ );
|
|
4246
|
-
}
|
|
4247
|
-
if (display === "table-row") {
|
|
4248
|
-
// omitting case: and node's CSS box is not the last 'table-row' box of the nearest ancestor 'table' box
|
|
4249
|
-
items.push("\n" /* line feed */ );
|
|
4250
|
-
}
|
|
4251
|
-
if (tagName === "P") {
|
|
4252
|
-
items.unshift(2);
|
|
4253
|
-
items.push(2);
|
|
4254
|
-
}
|
|
4255
|
-
if (display === "block" || display === "table-caption" || display === "flex" || display === "table") {
|
|
4256
|
-
items.unshift(1);
|
|
4257
|
-
items.push(1);
|
|
4258
|
-
}
|
|
4259
|
-
} else if (nodeIsText(node)) {
|
|
4260
|
-
items.push(getTextNodeInnerText(node));
|
|
4261
|
-
}
|
|
4262
|
-
return items;
|
|
4263
|
-
}
|
|
4264
|
-
/**
|
|
4265
|
-
* InnerText getter spec: https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute
|
|
4266
|
-
*
|
|
4267
|
-
* One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1087
|
|
4268
|
-
*/ function getInnerText(element) {
|
|
4269
|
-
var thisComputedStyle = getElementComputedStyle(element);
|
|
4270
|
-
if (!nodeIsBeingRendered(thisComputedStyle)) {
|
|
4271
|
-
return getTextContent(element) || "";
|
|
4272
|
-
}
|
|
4273
|
-
var selectionState = getSelectionState(element);
|
|
4274
|
-
var results = [];
|
|
4275
|
-
var childNodes = element.childNodes;
|
|
4276
|
-
for(var i = 0, n = childNodes.length; i < n; i++){
|
|
4277
|
-
ArrayPush.apply(results, innerTextCollectionSteps(childNodes[i]));
|
|
4278
|
-
}
|
|
4279
|
-
restoreSelectionState(selectionState);
|
|
4280
|
-
var elementInnerText = "";
|
|
4281
|
-
var maxReqLineBreakCount = 0;
|
|
4282
|
-
for(var i1 = 0, n1 = results.length; i1 < n1; i1++){
|
|
4283
|
-
var item = results[i1];
|
|
4284
|
-
if (typeof item === "string") {
|
|
4285
|
-
if (maxReqLineBreakCount > 0) {
|
|
4286
|
-
for(var j = 0; j < maxReqLineBreakCount; j++){
|
|
4287
|
-
elementInnerText += "\n";
|
|
4288
|
-
}
|
|
4289
|
-
maxReqLineBreakCount = 0;
|
|
4290
|
-
}
|
|
4291
|
-
if (item.length > 0) {
|
|
4292
|
-
elementInnerText += item;
|
|
4293
|
-
}
|
|
4294
|
-
} else {
|
|
4295
|
-
if (elementInnerText.length == 0) {
|
|
4296
|
-
continue;
|
|
4297
|
-
}
|
|
4298
|
-
// Store the count if it's the max of this run,
|
|
4299
|
-
// but it may be ignored if no text item is found afterwards,
|
|
4300
|
-
// which means that these are consecutive line breaks at the end.
|
|
4301
|
-
if (item > maxReqLineBreakCount) {
|
|
4302
|
-
maxReqLineBreakCount = item;
|
|
4303
|
-
}
|
|
4304
|
-
}
|
|
4305
|
-
}
|
|
4306
|
-
return elementInnerText;
|
|
4307
|
-
}
|
|
4308
4308
|
/*
|
|
4309
4309
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4310
4310
|
* All rights reserved.
|
|
@@ -4639,6 +4639,6 @@
|
|
|
4639
4639
|
return this[DomManualPrivateKey];
|
|
4640
4640
|
},
|
|
4641
4641
|
configurable: true
|
|
4642
|
-
}); /** version: 2.13.
|
|
4642
|
+
}); /** version: 2.13.3 */
|
|
4643
4643
|
|
|
4644
4644
|
}));
|