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