From e4b62a920a5ed9c48c46865f987702fa67369ae0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?utf8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Thu, 27 Jan 2022 10:43:27 +0200 Subject: [PATCH] src/tooltip.js Optimization Util.findShadowRoot() returns either null or an object. It cannot return falsy, which allows this optimization. --- js/src/tooltip.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 -- 2.47.2