0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-29 21:52:22 +01:00

Move from $.proxy to es6 arrow functions. (#21049)

This commit is contained in:
Bardi Harborow 2016-11-01 14:32:36 +11:00 committed by Mark Otto
parent d6cc0e017d
commit 0974267b8c
6 changed files with 14 additions and 18 deletions

View File

@ -117,7 +117,7 @@ const Alert = (($) => {
}
$(element)
.one(Util.TRANSITION_END, $.proxy(this._destroyElement, this, element))
.one(Util.TRANSITION_END, (event) => this._destroyElement(element, event))
.emulateTransitionEnd(TRANSITION_DURATION)
}

View File

@ -161,7 +161,7 @@ const Carousel = (($) => {
if (this._config.interval && !this._isPaused) {
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() {
if (this._config.keyboard) {
$(this._element)
.on(Event.KEYDOWN, $.proxy(this._keydown, this))
.on(Event.KEYDOWN, (event) => this._keydown(event))
}
if (this._config.pause === 'hover' &&
!('ontouchstart' in document.documentElement)) {
$(this._element)
.on(Event.MOUSEENTER, $.proxy(this.pause, this))
.on(Event.MOUSELEAVE, $.proxy(this.cycle, this))
.on(Event.MOUSEENTER, (event) => this.pause(event))
.on(Event.MOUSELEAVE, (event) => this.cycle(event))
}
}

View File

@ -133,7 +133,7 @@ const Modal = (($) => {
$(this._element).on(
Event.CLICK_DISMISS,
Selector.DATA_DISMISS,
$.proxy(this.hide, this)
(event) => this.hide(event)
)
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, () => {
@ -144,9 +144,7 @@ const Modal = (($) => {
})
})
this._showBackdrop(
$.proxy(this._showElement, this, relatedTarget)
)
this._showBackdrop(() => this._showElement(relatedTarget))
}
hide(event) {
@ -178,7 +176,7 @@ const Modal = (($) => {
($(this._element).hasClass(ClassName.FADE))) {
$(this._element)
.one(Util.TRANSITION_END, $.proxy(this._hideModal, this))
.one(Util.TRANSITION_END, (event) => this._hideModal(event))
.emulateTransitionEnd(TRANSITION_DURATION)
} else {
this._hideModal()
@ -284,7 +282,7 @@ const Modal = (($) => {
_setResizeEvent() {
if (this._isShown) {
$(window).on(Event.RESIZE, $.proxy(this._handleUpdate, this))
$(window).on(Event.RESIZE, (event) => this._handleUpdate(event))
} else {
$(window).off(Event.RESIZE)
}

View File

@ -87,7 +87,7 @@ const ScrollSpy = (($) => {
this._activeTarget = null
this._scrollHeight = 0
$(this._scrollElement).on(Event.SCROLL, $.proxy(this._process, this))
$(this._scrollElement).on(Event.SCROLL, (event) => this._process(event))
this.refresh()
this._process()

View File

@ -156,9 +156,7 @@ const Tab = (($) => {
&& ((active && $(active).hasClass(ClassName.FADE))
|| Boolean($(container).find(Selector.FADE_CHILD)[0]))
let complete = $.proxy(
this._transitionComplete,
this,
let complete = () => this._transitionComplete(
element,
active,
isTransitioning,

View File

@ -426,7 +426,7 @@ const Tooltip = (($) => {
$(this.element).on(
this.constructor.Event.CLICK,
this.config.selector,
$.proxy(this.toggle, this)
(event) => this.toggle(event)
)
} else if (trigger !== Trigger.MANUAL) {
@ -441,12 +441,12 @@ const Tooltip = (($) => {
.on(
eventIn,
this.config.selector,
$.proxy(this._enter, this)
(event) => this._enter(event)
)
.on(
eventOut,
this.config.selector,
$.proxy(this._leave, this)
(event) => this._leave(event)
)
}
})