diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 5cf56ce6e39af84ed165dd663b59d7c822f2fd7b..db626048f67bf56f91080b7b9157c09204f08643 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