mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-22 15:39:59 +00: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:
parent
28d9aaf670
commit
e4b62a920a
@ -199,9 +199,7 @@ class Tooltip extends BaseComponent {
|
|||||||
|
|
||||||
const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW))
|
const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW))
|
||||||
const shadowRoot = findShadowRoot(this._element)
|
const shadowRoot = findShadowRoot(this._element)
|
||||||
const isInTheDom = shadowRoot === null ?
|
const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element)
|
||||||
this._element.ownerDocument.documentElement.contains(this._element) :
|
|
||||||
shadowRoot.contains(this._element)
|
|
||||||
|
|
||||||
if (showEvent.defaultPrevented || !isInTheDom) {
|
if (showEvent.defaultPrevented || !isInTheDom) {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user