From: Дилян Палаузов Date: Thu, 27 Jan 2022 08:43:27 +0000 (+0200) Subject: src/tooltip.js Optimization X-Git-Tag: v5.2.0-beta1~217 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4b62a920a5ed9c48c46865f987702fa67369ae0;p=thirdparty%2Fbootstrap.git src/tooltip.js Optimization Util.findShadowRoot() returns either null or an object. It cannot return falsy, which allows this optimization. --- diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 5cf56ce6e3..db626048f6 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