aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorДилян Палаузов <[email protected]>2022-01-27 10:43:27 +0200
committerMark Otto <[email protected]>2022-02-25 09:01:49 -0800
commite4b62a920a5ed9c48c46865f987702fa67369ae0 (patch)
tree51fb2b23c11c067f78763f8369a2eec0121f5f47
parent28d9aaf6708b4b84e7e70a62b78d8b22a51d990d (diff)
downloadbootstrap-e4b62a920a5ed9c48c46865f987702fa67369ae0.tar.xz
bootstrap-e4b62a920a5ed9c48c46865f987702fa67369ae0.zip
src/tooltip.js Optimization
Util.findShadowRoot() returns either null or an object. It cannot return falsy, which allows this optimization.
-rw-r--r--js/src/tooltip.js4
1 files changed, 1 insertions, 3 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index 5cf56ce6e..db626048f 100644
--- a/js/src/tooltip.js
+++ b/js/src/tooltip.js
@@ -199,9 +199,7 @@ class Tooltip extends BaseComponent {
const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW))
const shadowRoot = findShadowRoot(this._element)
- const isInTheDom = shadowRoot === null ?
- this._element.ownerDocument.documentElement.contains(this._element) :
- shadowRoot.contains(this._element)
+ const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element)
if (showEvent.defaultPrevented || !isInTheDom) {
return