0
0
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:
Rohit Sharma 2021-03-27 21:38:45 +05:30 committed by XhmikosR
parent 7b7f4a5ced
commit b2bc159d72
4 changed files with 7 additions and 7 deletions

View File

@ -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) {

View File

@ -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)
})
}

View File

@ -190,7 +190,7 @@ const findShadowRoot = element => {
return findShadowRoot(element.parentNode)
}
const noop = () => function () {}
const noop = () => {}
const reflow = element => element.offsetHeight

View File

@ -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')
})
})