diff options
author | Дилян Палаузов <git-dpa@aegee.org> | 2022-01-27 11:43:27 +0300 |
---|---|---|
committer | Mark Otto <otto@github.com> | 2022-02-25 20:01:49 +0300 |
commit | e4b62a920a5ed9c48c46865f987702fa67369ae0 (patch) | |
tree | 51fb2b23c11c067f78763f8369a2eec0121f5f47 /js/src/tooltip.js | |
parent | 28d9aaf6708b4b84e7e70a62b78d8b22a51d990d (diff) |
src/tooltip.js Optimization
Util.findShadowRoot() returns either null or an object.
It cannot return falsy, which allows this optimization.
Diffstat (limited to 'js/src/tooltip.js')
-rw-r--r-- | js/src/tooltip.js | 4 |
1 files changed, 1 insertions, 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 |