diff options
| author | Mark Otto <[email protected]> | 2017-04-21 23:36:24 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2017-04-21 23:36:24 -0700 |
| commit | 5463d8436b6404f5c647fb12e0cd0eafa4abf5e0 (patch) | |
| tree | ada6f9b1f4990a182d829055ee079db9601dbf9b /js/src/tooltip.js | |
| parent | 7efe4ddee499396efc40f53d1421b61fe5da328d (diff) | |
| parent | 638b97f19c4df6f51475f8088555e3eefd2b986f (diff) | |
| download | bootstrap-5463d8436b6404f5c647fb12e0cd0eafa4abf5e0.tar.xz bootstrap-5463d8436b6404f5c647fb12e0cd0eafa4abf5e0.zip | |
Merge branch 'v4-dev' into form-tweaks
Diffstat (limited to 'js/src/tooltip.js')
| -rw-r--r-- | js/src/tooltip.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 1ff2c4f6e..47c3d8d05 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -304,6 +304,14 @@ const Tooltip = (($) => { $(tip).addClass(ClassName.SHOW) + // if this is a touch-enabled device we add extra + // 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 ('ontouchstart' in document.documentElement) { + $('body').children().on('mouseover', null, $.noop) + } + const complete = () => { const prevHoverState = this._hoverState this._hoverState = null @@ -352,6 +360,12 @@ const Tooltip = (($) => { $(tip).removeClass(ClassName.SHOW) + // if this is a touch-enabled device we remove the extra + // empty mouseover listeners we added for iOS support + if ('ontouchstart' in document.documentElement) { + $('body').children().off('mouseover', null, $.noop) + } + this._activeTrigger[Trigger.CLICK] = false this._activeTrigger[Trigger.FOCUS] = false this._activeTrigger[Trigger.HOVER] = false @@ -368,6 +382,7 @@ const Tooltip = (($) => { } this._hoverState = '' + } |
