mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
Use cached noop
function everywhere
This commit is contained in:
parent
7b7f4a5ced
commit
b2bc159d72
@ -192,7 +192,7 @@ class Dropdown extends BaseComponent {
|
||||
if ('ontouchstart' in document.documentElement &&
|
||||
!parent.closest(SELECTOR_NAVBAR_NAV)) {
|
||||
[].concat(...document.body.children)
|
||||
.forEach(elem => EventHandler.on(elem, 'mouseover', null, noop()))
|
||||
.forEach(elem => EventHandler.on(elem, 'mouseover', null, noop))
|
||||
}
|
||||
|
||||
this._element.focus()
|
||||
@ -222,7 +222,7 @@ class Dropdown extends BaseComponent {
|
||||
// empty mouseover listeners we added for iOS support
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
[].concat(...document.body.children)
|
||||
.forEach(elem => EventHandler.off(elem, 'mouseover', null, noop()))
|
||||
.forEach(elem => EventHandler.off(elem, 'mouseover', null, noop))
|
||||
}
|
||||
|
||||
if (this._popper) {
|
||||
@ -435,7 +435,7 @@ class Dropdown extends BaseComponent {
|
||||
// empty mouseover listeners we added for iOS support
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
[].concat(...document.body.children)
|
||||
.forEach(elem => EventHandler.off(elem, 'mouseover', null, noop()))
|
||||
.forEach(elem => EventHandler.off(elem, 'mouseover', null, noop))
|
||||
}
|
||||
|
||||
if (context._popper) {
|
||||
|
@ -301,7 +301,7 @@ class Tooltip extends BaseComponent {
|
||||
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
[].concat(...document.body.children).forEach(element => {
|
||||
EventHandler.on(element, 'mouseover', noop())
|
||||
EventHandler.on(element, 'mouseover', noop)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ const findShadowRoot = element => {
|
||||
return findShadowRoot(element.parentNode)
|
||||
}
|
||||
|
||||
const noop = () => function () {}
|
||||
const noop = () => {}
|
||||
|
||||
const reflow = element => element.offsetHeight
|
||||
|
||||
|
@ -477,8 +477,8 @@ describe('Util', () => {
|
||||
})
|
||||
|
||||
describe('noop', () => {
|
||||
it('should return a function', () => {
|
||||
expect(typeof Util.noop()).toEqual('function')
|
||||
it('should be a function', () => {
|
||||
expect(typeof Util.noop).toEqual('function')
|
||||
})
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user