2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-05-15 11:59:39 +03:00

src/tooltip.js Optimization

Util.findShadowRoot() returns either null or an object.

It cannot return falsy, which allows this optimization.
This commit is contained in:
Дилян Палаузов
2022-01-27 10:43:27 +02:00
committed by Mark Otto
parent 28d9aaf670
commit e4b62a920a
+1 -3
View File
@@ -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