mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-29 21:52:22 +01:00
Add polyfill for focusin and focusout
This commit is contained in:
parent
aba87279fd
commit
c5595e5b67
@ -133,7 +133,7 @@ const EventHandler = {
|
|||||||
const fn = !delegation ? bootstrapHandler(element, handler) : bootstrapDelegationHandler(handler, delegationFn)
|
const fn = !delegation ? bootstrapHandler(element, handler) : bootstrapDelegationHandler(handler, delegationFn)
|
||||||
handlers[uid] = fn
|
handlers[uid] = fn
|
||||||
originalHandler.uidEvent = uid
|
originalHandler.uidEvent = uid
|
||||||
element.addEventListener(typeEvent, fn, false)
|
element.addEventListener(typeEvent, fn, delegation)
|
||||||
},
|
},
|
||||||
|
|
||||||
one(element, event, handler) {
|
one(element, event, handler) {
|
||||||
@ -193,4 +193,18 @@ const EventHandler = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// focusin and focusout polyfill
|
||||||
|
if (typeof window.onfocusin === 'undefined') {
|
||||||
|
(() => {
|
||||||
|
function listenerFocus(event) {
|
||||||
|
EventHandler.trigger(event.target, 'focusin')
|
||||||
|
}
|
||||||
|
function listenerBlur(event) {
|
||||||
|
EventHandler.trigger(event.target, 'focusout')
|
||||||
|
}
|
||||||
|
EventHandler.on(document, 'focus', 'input', listenerFocus)
|
||||||
|
EventHandler.on(document, 'blur', 'input', listenerBlur)
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
|
||||||
export default EventHandler
|
export default EventHandler
|
||||||
|
Loading…
x
Reference in New Issue
Block a user