Change isTouchEnabledDevice to a function
So that the presence of `ontouchstart` method can be checked in the runtime
This commit is contained in:
parent
70bba97f6c
commit
88783b3f82
4 changed files with 6 additions and 6 deletions
|
|
@ -119,7 +119,7 @@ class Carousel extends BaseComponent {
|
|||
|
||||
this._config = this._getConfig(config)
|
||||
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element)
|
||||
this._touchSupported = isTouchEnabledDevice || navigator.maxTouchPoints > 0
|
||||
this._touchSupported = isTouchEnabledDevice() || navigator.maxTouchPoints > 0
|
||||
this._pointerEvent = Boolean(window.PointerEvent)
|
||||
|
||||
this._addEventListeners()
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ class Dropdown extends BaseComponent {
|
|||
// empty mouseover listeners to the body's immediate children;
|
||||
// only needed because of broken event delegation on iOS
|
||||
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
||||
if (isTouchEnabledDevice && !parent.closest(SELECTOR_NAVBAR_NAV)) {
|
||||
if (isTouchEnabledDevice() && !parent.closest(SELECTOR_NAVBAR_NAV)) {
|
||||
[].concat(...document.body.children).forEach(element => {
|
||||
EventHandler.on(element, 'mouseover', null, noop)
|
||||
})
|
||||
|
|
@ -382,7 +382,7 @@ class Dropdown extends BaseComponent {
|
|||
|
||||
// If this is a touch-enabled device we remove the extra
|
||||
// empty mouseover listeners we added for iOS support
|
||||
if (isTouchEnabledDevice) {
|
||||
if (isTouchEnabledDevice()) {
|
||||
[].concat(...document.body.children).forEach(element => {
|
||||
EventHandler.off(element, 'mouseover', null, noop)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ class Tooltip extends BaseComponent {
|
|||
// empty mouseover listeners to the body's immediate children;
|
||||
// only needed because of broken event delegation on iOS
|
||||
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
||||
if (isTouchEnabledDevice) {
|
||||
if (isTouchEnabledDevice()) {
|
||||
[].concat(...document.body.children).forEach(element => {
|
||||
EventHandler.on(element, 'mouseover', noop)
|
||||
})
|
||||
|
|
@ -356,7 +356,7 @@ class Tooltip extends BaseComponent {
|
|||
|
||||
// If this is a touch-enabled device we remove the extra
|
||||
// empty mouseover listeners we added for iOS support
|
||||
if (isTouchEnabledDevice) {
|
||||
if (isTouchEnabledDevice()) {
|
||||
[].concat(...document.body.children).forEach(element => {
|
||||
EventHandler.off(element, 'mouseover', noop)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ const defineJQueryPlugin = (name, plugin) => {
|
|||
})
|
||||
}
|
||||
|
||||
const isTouchEnabledDevice = 'ontouchstart' in document.documentElement
|
||||
const isTouchEnabledDevice = () => 'ontouchstart' in document.documentElement
|
||||
|
||||
export {
|
||||
TRANSITION_END,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue