mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-19 16:54:24 +01:00
Move from $.proxy to es6 arrow functions. (#21049)
This commit is contained in:
parent
d6cc0e017d
commit
0974267b8c
@ -117,7 +117,7 @@ const Alert = (($) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(element)
|
$(element)
|
||||||
.one(Util.TRANSITION_END, $.proxy(this._destroyElement, this, element))
|
.one(Util.TRANSITION_END, (event) => this._destroyElement(element, event))
|
||||||
.emulateTransitionEnd(TRANSITION_DURATION)
|
.emulateTransitionEnd(TRANSITION_DURATION)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ const Carousel = (($) => {
|
|||||||
|
|
||||||
if (this._config.interval && !this._isPaused) {
|
if (this._config.interval && !this._isPaused) {
|
||||||
this._interval = setInterval(
|
this._interval = setInterval(
|
||||||
$.proxy(document.visibilityState ? this.nextWhenVisible : this.next, this), this._config.interval
|
(document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,14 +219,14 @@ const Carousel = (($) => {
|
|||||||
_addEventListeners() {
|
_addEventListeners() {
|
||||||
if (this._config.keyboard) {
|
if (this._config.keyboard) {
|
||||||
$(this._element)
|
$(this._element)
|
||||||
.on(Event.KEYDOWN, $.proxy(this._keydown, this))
|
.on(Event.KEYDOWN, (event) => this._keydown(event))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config.pause === 'hover' &&
|
if (this._config.pause === 'hover' &&
|
||||||
!('ontouchstart' in document.documentElement)) {
|
!('ontouchstart' in document.documentElement)) {
|
||||||
$(this._element)
|
$(this._element)
|
||||||
.on(Event.MOUSEENTER, $.proxy(this.pause, this))
|
.on(Event.MOUSEENTER, (event) => this.pause(event))
|
||||||
.on(Event.MOUSELEAVE, $.proxy(this.cycle, this))
|
.on(Event.MOUSELEAVE, (event) => this.cycle(event))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ const Modal = (($) => {
|
|||||||
$(this._element).on(
|
$(this._element).on(
|
||||||
Event.CLICK_DISMISS,
|
Event.CLICK_DISMISS,
|
||||||
Selector.DATA_DISMISS,
|
Selector.DATA_DISMISS,
|
||||||
$.proxy(this.hide, this)
|
(event) => this.hide(event)
|
||||||
)
|
)
|
||||||
|
|
||||||
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, () => {
|
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, () => {
|
||||||
@ -144,9 +144,7 @@ const Modal = (($) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
this._showBackdrop(
|
this._showBackdrop(() => this._showElement(relatedTarget))
|
||||||
$.proxy(this._showElement, this, relatedTarget)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hide(event) {
|
hide(event) {
|
||||||
@ -178,7 +176,7 @@ const Modal = (($) => {
|
|||||||
($(this._element).hasClass(ClassName.FADE))) {
|
($(this._element).hasClass(ClassName.FADE))) {
|
||||||
|
|
||||||
$(this._element)
|
$(this._element)
|
||||||
.one(Util.TRANSITION_END, $.proxy(this._hideModal, this))
|
.one(Util.TRANSITION_END, (event) => this._hideModal(event))
|
||||||
.emulateTransitionEnd(TRANSITION_DURATION)
|
.emulateTransitionEnd(TRANSITION_DURATION)
|
||||||
} else {
|
} else {
|
||||||
this._hideModal()
|
this._hideModal()
|
||||||
@ -284,7 +282,7 @@ const Modal = (($) => {
|
|||||||
|
|
||||||
_setResizeEvent() {
|
_setResizeEvent() {
|
||||||
if (this._isShown) {
|
if (this._isShown) {
|
||||||
$(window).on(Event.RESIZE, $.proxy(this._handleUpdate, this))
|
$(window).on(Event.RESIZE, (event) => this._handleUpdate(event))
|
||||||
} else {
|
} else {
|
||||||
$(window).off(Event.RESIZE)
|
$(window).off(Event.RESIZE)
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ const ScrollSpy = (($) => {
|
|||||||
this._activeTarget = null
|
this._activeTarget = null
|
||||||
this._scrollHeight = 0
|
this._scrollHeight = 0
|
||||||
|
|
||||||
$(this._scrollElement).on(Event.SCROLL, $.proxy(this._process, this))
|
$(this._scrollElement).on(Event.SCROLL, (event) => this._process(event))
|
||||||
|
|
||||||
this.refresh()
|
this.refresh()
|
||||||
this._process()
|
this._process()
|
||||||
|
@ -156,9 +156,7 @@ const Tab = (($) => {
|
|||||||
&& ((active && $(active).hasClass(ClassName.FADE))
|
&& ((active && $(active).hasClass(ClassName.FADE))
|
||||||
|| Boolean($(container).find(Selector.FADE_CHILD)[0]))
|
|| Boolean($(container).find(Selector.FADE_CHILD)[0]))
|
||||||
|
|
||||||
let complete = $.proxy(
|
let complete = () => this._transitionComplete(
|
||||||
this._transitionComplete,
|
|
||||||
this,
|
|
||||||
element,
|
element,
|
||||||
active,
|
active,
|
||||||
isTransitioning,
|
isTransitioning,
|
||||||
|
@ -426,7 +426,7 @@ const Tooltip = (($) => {
|
|||||||
$(this.element).on(
|
$(this.element).on(
|
||||||
this.constructor.Event.CLICK,
|
this.constructor.Event.CLICK,
|
||||||
this.config.selector,
|
this.config.selector,
|
||||||
$.proxy(this.toggle, this)
|
(event) => this.toggle(event)
|
||||||
)
|
)
|
||||||
|
|
||||||
} else if (trigger !== Trigger.MANUAL) {
|
} else if (trigger !== Trigger.MANUAL) {
|
||||||
@ -441,12 +441,12 @@ const Tooltip = (($) => {
|
|||||||
.on(
|
.on(
|
||||||
eventIn,
|
eventIn,
|
||||||
this.config.selector,
|
this.config.selector,
|
||||||
$.proxy(this._enter, this)
|
(event) => this._enter(event)
|
||||||
)
|
)
|
||||||
.on(
|
.on(
|
||||||
eventOut,
|
eventOut,
|
||||||
this.config.selector,
|
this.config.selector,
|
||||||
$.proxy(this._leave, this)
|
(event) => this._leave(event)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user