]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Move from $.proxy to es6 arrow functions. (#21049)
authorBardi Harborow <bardi@bardiharborow.com>
Tue, 1 Nov 2016 03:32:36 +0000 (14:32 +1100)
committerMark Otto <markd.otto@gmail.com>
Tue, 1 Nov 2016 03:32:36 +0000 (20:32 -0700)
js/src/alert.js
js/src/carousel.js
js/src/modal.js
js/src/scrollspy.js
js/src/tab.js
js/src/tooltip.js

index 0456c677df37ee0fed83d81c3d4bc72315426bb1..27411e276c148118d8b68ba843e689c0f63bda6c 100644 (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)
     }
 
index 54249039e683b24124f704aabada4325dc987680..17bfebc6882f939eec5230091def3928c96fb779 100644 (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))
       }
     }
 
index 252637428732e9cf95d6f72babd7210a7ce44cca..a52dcb07fa8943edb523c34574586fef98a0e810 100644 (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)
       }
index 604815f4e005bbcbcf088f800b04834778906035..648173b33b6de1a5a4789ba9b6e62fe397a57bd4 100644 (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()
index c625a010d5967127d5fcbb8f93365315be406ce7..012d2f76fc63e5c3108650566b7df0398615b20f 100644 (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,
index 90e782dc92061bc76ecd2a1c2f53e1cd7cb74f3f..6c23b9f9dde7168b7389552a1709ba5d0bc00c09 100644 (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)
             )
         }
       })