]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Make JS compliant with the new ESLint rules. 21005/head
authorBardi Harborow <bardi@bardiharborow.com>
Mon, 21 Nov 2016 14:36:00 +0000 (01:36 +1100)
committerBardi Harborow <bardi@bardiharborow.com>
Thu, 24 Nov 2016 00:59:55 +0000 (11:59 +1100)
22 files changed:
js/src/alert.js
js/src/button.js
js/src/carousel.js
js/src/collapse.js
js/src/dropdown.js
js/src/modal.js
js/src/popover.js
js/src/scrollspy.js
js/src/tab.js
js/src/tooltip.js
js/src/util.js
js/tests/unit/alert.js
js/tests/unit/button.js
js/tests/unit/carousel.js
js/tests/unit/collapse.js
js/tests/unit/dropdown.js
js/tests/unit/modal.js
js/tests/unit/phantom.js
js/tests/unit/popover.js
js/tests/unit/scrollspy.js
js/tests/unit/tab.js
js/tests/unit/tooltip.js

index 27411e276c148118d8b68ba843e689c0f63bda6c..8e55249501739455a220fb2fca7fa2067525ea0c 100644 (file)
@@ -67,8 +67,8 @@ const Alert = (($) => {
     close(element) {
       element = element || this._element
 
-      let rootElement = this._getRootElement(element)
-      let customEvent = this._triggerCloseEvent(rootElement)
+      const rootElement = this._getRootElement(element)
+      const customEvent = this._triggerCloseEvent(rootElement)
 
       if (customEvent.isDefaultPrevented()) {
         return
@@ -86,8 +86,8 @@ const Alert = (($) => {
     // private
 
     _getRootElement(element) {
-      let selector = Util.getSelectorFromElement(element)
-      let parent   = false
+      const selector = Util.getSelectorFromElement(element)
+      let parent     = false
 
       if (selector) {
         parent = $(selector)[0]
@@ -101,7 +101,7 @@ const Alert = (($) => {
     }
 
     _triggerCloseEvent(element) {
-      let closeEvent = $.Event(Event.CLOSE)
+      const closeEvent = $.Event(Event.CLOSE)
 
       $(element).trigger(closeEvent)
       return closeEvent
@@ -133,8 +133,8 @@ const Alert = (($) => {
 
     static _jQueryInterface(config) {
       return this.each(function () {
-        let $element = $(this)
-        let data     = $element.data(DATA_KEY)
+        const $element = $(this)
+        let data       = $element.data(DATA_KEY)
 
         if (!data) {
           data = new Alert(this)
index a7eed182626332faddbb4af5584938b70f2bf73e..8b95117657677a47135e1de9b32708e20d6d9bc4 100644 (file)
@@ -66,12 +66,12 @@ const Button = (($) => {
 
     toggle() {
       let triggerChangeEvent = true
-      let rootElement        = $(this._element).closest(
+      const rootElement      = $(this._element).closest(
         Selector.DATA_TOGGLE
       )[0]
 
       if (rootElement) {
-        let input = $(this._element).find(Selector.INPUT)[0]
+        const input = $(this._element).find(Selector.INPUT)[0]
 
         if (input) {
           if (input.type === 'radio') {
@@ -80,7 +80,7 @@ const Button = (($) => {
               triggerChangeEvent = false
 
             } else {
-              let activeElement = $(rootElement).find(Selector.ACTIVE)[0]
+              const activeElement = $(rootElement).find(Selector.ACTIVE)[0]
 
               if (activeElement) {
                 $(activeElement).removeClass(ClassName.ACTIVE)
@@ -151,7 +151,7 @@ const Button = (($) => {
       Button._jQueryInterface.call($(button), 'toggle')
     })
     .on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, (event) => {
-      let button = $(event.target).closest(Selector.BUTTON)[0]
+      const button = $(event.target).closest(Selector.BUTTON)[0]
       $(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type))
     })
 
index 17bfebc6882f939eec5230091def3928c96fb779..b7f3b3a7a9115ba3c9fde9e5de335232c241274d 100644 (file)
@@ -161,7 +161,8 @@ const Carousel = (($) => {
 
       if (this._config.interval && !this._isPaused) {
         this._interval = setInterval(
-          (document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval
+          (document.visibilityState ? this.nextWhenVisible : this.next).bind(this),
+          this._config.interval
         )
       }
     }
@@ -169,9 +170,9 @@ const Carousel = (($) => {
     to(index) {
       this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]
 
-      let activeIndex = this._getItemIndex(this._activeElement)
+      const activeIndex = this._getItemIndex(this._activeElement)
 
-      if (index > (this._items.length - 1) || index < 0) {
+      if (index > this._items.length - 1 || index < 0) {
         return
       }
 
@@ -186,7 +187,7 @@ const Carousel = (($) => {
         return
       }
 
-      let direction = index > activeIndex ?
+      const direction = index > activeIndex ?
         Direction.NEXT :
         Direction.PREVIOUS
 
@@ -255,19 +256,19 @@ const Carousel = (($) => {
     }
 
     _getItemByDirection(direction, activeElement) {
-      let isNextDirection = direction === Direction.NEXT
-      let isPrevDirection = direction === Direction.PREVIOUS
-      let activeIndex     = this._getItemIndex(activeElement)
-      let lastItemIndex   = (this._items.length - 1)
-      let isGoingToWrap   = (isPrevDirection && activeIndex === 0) ||
-                            (isNextDirection && activeIndex === lastItemIndex)
+      const isNextDirection = direction === Direction.NEXT
+      const isPrevDirection = direction === Direction.PREVIOUS
+      const activeIndex     = this._getItemIndex(activeElement)
+      const lastItemIndex   = this._items.length - 1
+      const isGoingToWrap   = isPrevDirection && activeIndex === 0 ||
+                              isNextDirection && activeIndex === lastItemIndex
 
       if (isGoingToWrap && !this._config.wrap) {
         return activeElement
       }
 
-      let delta     = direction === Direction.PREVIOUS ? -1 : 1
-      let itemIndex = (activeIndex + delta) % this._items.length
+      const delta     = direction === Direction.PREVIOUS ? -1 : 1
+      const itemIndex = (activeIndex + delta) % this._items.length
 
       return itemIndex === -1 ?
         this._items[this._items.length - 1] : this._items[itemIndex]
@@ -275,7 +276,7 @@ const Carousel = (($) => {
 
 
     _triggerSlideEvent(relatedTarget, directionalClassname) {
-      let slideEvent = $.Event(Event.SLIDE, {
+      const slideEvent = $.Event(Event.SLIDE, {
         relatedTarget,
         direction: directionalClassname
       })
@@ -291,7 +292,7 @@ const Carousel = (($) => {
           .find(Selector.ACTIVE)
           .removeClass(ClassName.ACTIVE)
 
-        let nextIndicator = this._indicatorsElement.children[
+        const nextIndicator = this._indicatorsElement.children[
           this._getItemIndex(element)
         ]
 
@@ -302,13 +303,13 @@ const Carousel = (($) => {
     }
 
     _slide(direction, element) {
-      let activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]
-      let nextElement   = element || activeElement &&
+      const activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]
+      const nextElement   = element || activeElement &&
         this._getItemByDirection(direction, activeElement)
 
-      let isCycling = Boolean(this._interval)
+      const isCycling = Boolean(this._interval)
 
-      let directionalClassName = direction === Direction.NEXT ?
+      const directionalClassName = direction === Direction.NEXT ?
         ClassName.LEFT :
         ClassName.RIGHT
 
@@ -317,7 +318,7 @@ const Carousel = (($) => {
         return
       }
 
-      let slideEvent = this._triggerSlideEvent(nextElement, directionalClassName)
+      const slideEvent = this._triggerSlideEvent(nextElement, directionalClassName)
       if (slideEvent.isDefaultPrevented()) {
         return
       }
@@ -335,7 +336,7 @@ const Carousel = (($) => {
 
       this._setActiveIndicatorElement(nextElement)
 
-      let slidEvent = $.Event(Event.SLID, {
+      const slidEvent = $.Event(Event.SLID, {
         relatedTarget: nextElement,
         direction: directionalClassName
       })
@@ -389,13 +390,13 @@ const Carousel = (($) => {
     static _jQueryInterface(config) {
       return this.each(function () {
         let data      = $(this).data(DATA_KEY)
-        let _config = $.extend({}, Default, $(this).data())
+        const _config = $.extend({}, Default, $(this).data())
 
         if (typeof config === 'object') {
           $.extend(_config, config)
         }
 
-        let action = typeof config === 'string' ? config : _config.slide
+        const action = typeof config === 'string' ? config : _config.slide
 
         if (!data) {
           data = new Carousel(this, _config)
@@ -417,20 +418,20 @@ const Carousel = (($) => {
     }
 
     static _dataApiClickHandler(event) {
-      let selector = Util.getSelectorFromElement(this)
+      const selector = Util.getSelectorFromElement(this)
 
       if (!selector) {
         return
       }
 
-      let target = $(selector)[0]
+      const target = $(selector)[0]
 
       if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
         return
       }
 
-      let config     = $.extend({}, $(target).data(), $(this).data())
-      let slideIndex = this.getAttribute('data-slide-to')
+      const config     = $.extend({}, $(target).data(), $(this).data())
+      const slideIndex = this.getAttribute('data-slide-to')
 
       if (slideIndex) {
         config.interval = false
@@ -459,7 +460,7 @@ const Carousel = (($) => {
 
   $(window).on(Event.LOAD_DATA_API, () => {
     $(Selector.DATA_RIDE).each(function () {
-      let $carousel = $(this)
+      const $carousel = $(this)
       Carousel._jQueryInterface.call($carousel, $carousel.data())
     })
   })
index f700979e07719d807c02464ce26f44907c6817ee..ebc3e24cfe6c819f1c23c0b19c786fcd0dca8068 100644 (file)
@@ -134,7 +134,7 @@ const Collapse = (($) => {
         }
       }
 
-      let startEvent = $.Event(Event.SHOW)
+      const startEvent = $.Event(Event.SHOW)
       $(this._element).trigger(startEvent)
       if (startEvent.isDefaultPrevented()) {
         return
@@ -147,7 +147,7 @@ const Collapse = (($) => {
         }
       }
 
-      let dimension = this._getDimension()
+      const dimension = this._getDimension()
 
       $(this._element)
         .removeClass(ClassName.COLLAPSE)
@@ -164,7 +164,7 @@ const Collapse = (($) => {
 
       this.setTransitioning(true)
 
-      let complete = () => {
+      const complete = () => {
         $(this._element)
           .removeClass(ClassName.COLLAPSING)
           .addClass(ClassName.COLLAPSE)
@@ -182,8 +182,8 @@ const Collapse = (($) => {
         return
       }
 
-      let capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)
-      let scrollSize           = `scroll${capitalizedDimension}`
+      const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)
+      const scrollSize           = `scroll${capitalizedDimension}`
 
       $(this._element)
         .one(Util.TRANSITION_END, complete)
@@ -198,14 +198,14 @@ const Collapse = (($) => {
         return
       }
 
-      let startEvent = $.Event(Event.HIDE)
+      const startEvent = $.Event(Event.HIDE)
       $(this._element).trigger(startEvent)
       if (startEvent.isDefaultPrevented()) {
         return
       }
 
-      let dimension       = this._getDimension()
-      let offsetDimension = dimension === Dimension.WIDTH ?
+      const dimension       = this._getDimension()
+      const offsetDimension = dimension === Dimension.WIDTH ?
         'offsetWidth' : 'offsetHeight'
 
       this._element.style[dimension] = `${this._element[offsetDimension]}px`
@@ -227,7 +227,7 @@ const Collapse = (($) => {
 
       this.setTransitioning(true)
 
-      let complete = () => {
+      const complete = () => {
         this.setTransitioning(false)
         $(this._element)
           .removeClass(ClassName.COLLAPSING)
@@ -272,13 +272,13 @@ const Collapse = (($) => {
     }
 
     _getDimension() {
-      let hasWidth = $(this._element).hasClass(Dimension.WIDTH)
+      const hasWidth = $(this._element).hasClass(Dimension.WIDTH)
       return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT
     }
 
     _getParent() {
-      let parent   = $(this._config.parent)[0]
-      let selector =
+      const parent   = $(this._config.parent)[0]
+      const selector =
         `[data-toggle="collapse"][data-parent="${this._config.parent}"]`
 
       $(parent).find(selector).each((i, element) => {
@@ -293,7 +293,7 @@ const Collapse = (($) => {
 
     _addAriaAndCollapsedClass(element, triggerArray) {
       if (element) {
-        let isOpen = $(element).hasClass(ClassName.ACTIVE)
+        const isOpen = $(element).hasClass(ClassName.ACTIVE)
         element.setAttribute('aria-expanded', isOpen)
 
         if (triggerArray.length) {
@@ -308,15 +308,15 @@ const Collapse = (($) => {
     // static
 
     static _getTargetFromElement(element) {
-      let selector = Util.getSelectorFromElement(element)
+      const selector = Util.getSelectorFromElement(element)
       return selector ? $(selector)[0] : null
     }
 
     static _jQueryInterface(config) {
       return this.each(function () {
-        let $this   = $(this)
-        let data    = $this.data(DATA_KEY)
-        let _config = $.extend(
+        const $this   = $(this)
+        let data      = $this.data(DATA_KEY)
+        const _config = $.extend(
           {},
           Default,
           $this.data(),
@@ -353,9 +353,9 @@ const Collapse = (($) => {
   $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
     event.preventDefault()
 
-    let target = Collapse._getTargetFromElement(this)
-    let data   = $(target).data(DATA_KEY)
-    let config = data ? 'toggle' : $(this).data()
+    const target = Collapse._getTargetFromElement(this)
+    const data   = $(target).data(DATA_KEY)
+    const config = data ? 'toggle' : $(this).data()
 
     Collapse._jQueryInterface.call($(target), config)
   })
index 3246e6bef0ab2fee29224b87206fecc8e8d38213..644659266f78914646ae1b7e2b69a688baf1a7a3 100644 (file)
@@ -85,8 +85,8 @@ const Dropdown = (($) => {
         return false
       }
 
-      let parent   = Dropdown._getParentFromElement(this)
-      let isActive = $(parent).hasClass(ClassName.ACTIVE)
+      const parent   = Dropdown._getParentFromElement(this)
+      const isActive = $(parent).hasClass(ClassName.ACTIVE)
 
       Dropdown._clearMenus()
 
@@ -95,17 +95,19 @@ const Dropdown = (($) => {
       }
 
       if ('ontouchstart' in document.documentElement &&
-         (!$(parent).closest(Selector.NAVBAR_NAV).length)) {
+         !$(parent).closest(Selector.NAVBAR_NAV).length) {
 
         // if mobile we use a backdrop because click events don't delegate
-        let dropdown       = document.createElement('div')
+        const dropdown     = document.createElement('div')
         dropdown.className = ClassName.BACKDROP
         $(dropdown).insertBefore(this)
         $(dropdown).on('click', Dropdown._clearMenus)
       }
 
-      let relatedTarget = { relatedTarget : this }
-      let showEvent     = $.Event(Event.SHOW, relatedTarget)
+      const relatedTarget = {
+        relatedTarget : this
+      }
+      const showEvent     = $.Event(Event.SHOW, relatedTarget)
 
       $(parent).trigger(showEvent)
 
@@ -114,7 +116,7 @@ const Dropdown = (($) => {
       }
 
       this.focus()
-      this.setAttribute('aria-expanded', 'true')
+      this.setAttribute('aria-expanded', true)
 
       $(parent).toggleClass(ClassName.ACTIVE)
       $(parent).trigger($.Event(Event.SHOWN, relatedTarget))
@@ -140,10 +142,11 @@ const Dropdown = (($) => {
 
     static _jQueryInterface(config) {
       return this.each(function () {
-        let data  = $(this).data(DATA_KEY)
+        let data = $(this).data(DATA_KEY)
 
         if (!data) {
-          $(this).data(DATA_KEY, (data = new Dropdown(this)))
+          data = new Dropdown(this)
+          $(this).data(DATA_KEY, data)
         }
 
         if (typeof config === 'string') {
@@ -160,28 +163,30 @@ const Dropdown = (($) => {
         return
       }
 
-      let backdrop = $(Selector.BACKDROP)[0]
+      const backdrop = $(Selector.BACKDROP)[0]
       if (backdrop) {
         backdrop.parentNode.removeChild(backdrop)
       }
 
-      let toggles = $.makeArray($(Selector.DATA_TOGGLE))
+      const toggles = $.makeArray($(Selector.DATA_TOGGLE))
 
       for (let i = 0; i < toggles.length; i++) {
-        let parent        = Dropdown._getParentFromElement(toggles[i])
-        let relatedTarget = { relatedTarget : toggles[i] }
+        const parent        = Dropdown._getParentFromElement(toggles[i])
+        const relatedTarget = {
+          relatedTarget : toggles[i]
+        }
 
         if (!$(parent).hasClass(ClassName.ACTIVE)) {
           continue
         }
 
         if (event && event.type === 'click' &&
-           (/input|textarea/i.test(event.target.tagName)) &&
-           ($.contains(parent, event.target))) {
+           /input|textarea/i.test(event.target.tagName) &&
+           $.contains(parent, event.target)) {
           continue
         }
 
-        let hideEvent = $.Event(Event.HIDE, relatedTarget)
+        const hideEvent = $.Event(Event.HIDE, relatedTarget)
         $(parent).trigger(hideEvent)
         if (hideEvent.isDefaultPrevented()) {
           continue
@@ -197,7 +202,7 @@ const Dropdown = (($) => {
 
     static _getParentFromElement(element) {
       let parent
-      let selector = Util.getSelectorFromElement(element)
+      const selector = Util.getSelectorFromElement(element)
 
       if (selector) {
         parent = $(selector)[0]
@@ -219,14 +224,14 @@ const Dropdown = (($) => {
         return
       }
 
-      let parent   = Dropdown._getParentFromElement(this)
-      let isActive = $(parent).hasClass(ClassName.ACTIVE)
+      const parent   = Dropdown._getParentFromElement(this)
+      const isActive = $(parent).hasClass(ClassName.ACTIVE)
 
-      if ((!isActive && event.which !== ESCAPE_KEYCODE) ||
-           (isActive && event.which === ESCAPE_KEYCODE)) {
+      if (!isActive && event.which !== ESCAPE_KEYCODE ||
+           isActive && event.which === ESCAPE_KEYCODE) {
 
         if (event.which === ESCAPE_KEYCODE) {
-          let toggle = $(parent).find(Selector.DATA_TOGGLE)[0]
+          const toggle = $(parent).find(Selector.DATA_TOGGLE)[0]
           $(toggle).trigger('focus')
         }
 
index a52dcb07fa8943edb523c34574586fef98a0e810..5c2c0208aa13440f9c30ab1bf4552210e062c252 100644 (file)
@@ -110,7 +110,7 @@ const Modal = (($) => {
     }
 
     show(relatedTarget) {
-      let showEvent = $.Event(Event.SHOW, {
+      const showEvent = $.Event(Event.SHOW, {
         relatedTarget
       })
 
@@ -152,7 +152,7 @@ const Modal = (($) => {
         event.preventDefault()
       }
 
-      let hideEvent = $.Event(Event.HIDE)
+      const hideEvent = $.Event(Event.HIDE)
 
       $(this._element).trigger(hideEvent)
 
@@ -173,7 +173,7 @@ const Modal = (($) => {
       $(this._dialog).off(Event.MOUSEDOWN_DISMISS)
 
       if (Util.supportsTransitionEnd() &&
-         ($(this._element).hasClass(ClassName.FADE))) {
+         $(this._element).hasClass(ClassName.FADE)) {
 
         $(this._element)
           .one(Util.TRANSITION_END, (event) => this._hideModal(event))
@@ -212,11 +212,11 @@ const Modal = (($) => {
     }
 
     _showElement(relatedTarget) {
-      let transition = Util.supportsTransitionEnd() &&
+      const transition = Util.supportsTransitionEnd() &&
         $(this._element).hasClass(ClassName.FADE)
 
       if (!this._element.parentNode ||
-         (this._element.parentNode.nodeType !== Node.ELEMENT_NODE)) {
+         this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
         // don't move modals dom position
         document.body.appendChild(this._element)
       }
@@ -235,11 +235,11 @@ const Modal = (($) => {
         this._enforceFocus()
       }
 
-      let shownEvent = $.Event(Event.SHOWN, {
+      const shownEvent = $.Event(Event.SHOWN, {
         relatedTarget
       })
 
-      let transitionComplete = () => {
+      const transitionComplete = () => {
         if (this._config.focus) {
           this._element.focus()
         }
@@ -261,7 +261,7 @@ const Modal = (($) => {
         .on(Event.FOCUSIN, (event) => {
           if (document !== event.target &&
               this._element !== event.target &&
-              (!$(this._element).has(event.target).length)) {
+              !$(this._element).has(event.target).length) {
             this._element.focus()
           }
         })
@@ -290,7 +290,7 @@ const Modal = (($) => {
 
     _hideModal() {
       this._element.style.display = 'none'
-      this._element.setAttribute('aria-hidden', 'true')
+      this._element.setAttribute('aria-hidden', true)
       this._showBackdrop(() => {
         $(document.body).removeClass(ClassName.OPEN)
         this._resetAdjustments()
@@ -307,11 +307,11 @@ const Modal = (($) => {
     }
 
     _showBackdrop(callback) {
-      let animate = $(this._element).hasClass(ClassName.FADE) ?
+      const animate = $(this._element).hasClass(ClassName.FADE) ?
         ClassName.FADE : ''
 
       if (this._isShown && this._config.backdrop) {
-        let doAnimate = Util.supportsTransitionEnd() && animate
+        const doAnimate = Util.supportsTransitionEnd() && animate
 
         this._backdrop = document.createElement('div')
         this._backdrop.className = ClassName.BACKDROP
@@ -359,7 +359,7 @@ const Modal = (($) => {
       } else if (!this._isShown && this._backdrop) {
         $(this._backdrop).removeClass(ClassName.ACTIVE)
 
-        let callbackRemove = () => {
+        const callbackRemove = () => {
           this._removeBackdrop()
           if (callback) {
             callback()
@@ -367,7 +367,7 @@ const Modal = (($) => {
         }
 
         if (Util.supportsTransitionEnd() &&
-           ($(this._element).hasClass(ClassName.FADE))) {
+           $(this._element).hasClass(ClassName.FADE)) {
           $(this._backdrop)
             .one(Util.TRANSITION_END, callbackRemove)
             .emulateTransitionEnd(BACKDROP_TRANSITION_DURATION)
@@ -391,7 +391,7 @@ const Modal = (($) => {
     }
 
     _adjustDialog() {
-      let isModalOverflowing =
+      const isModalOverflowing =
         this._element.scrollHeight > document.documentElement.clientHeight
 
       if (!this._isBodyOverflowing && isModalOverflowing) {
@@ -414,7 +414,7 @@ const Modal = (($) => {
     }
 
     _setScrollbar() {
-      let bodyPadding = parseInt(
+      const bodyPadding = parseInt(
         $(Selector.FIXED_CONTENT).css('padding-right') || 0,
         10
       )
@@ -432,10 +432,10 @@ const Modal = (($) => {
     }
 
     _getScrollbarWidth() { // thx d.walsh
-      let scrollDiv = document.createElement('div')
+      const scrollDiv = document.createElement('div')
       scrollDiv.className = ClassName.SCROLLBAR_MEASURER
       document.body.appendChild(scrollDiv)
-      let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
+      const scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
       document.body.removeChild(scrollDiv)
       return scrollbarWidth
     }
@@ -445,8 +445,8 @@ const Modal = (($) => {
 
     static _jQueryInterface(config, relatedTarget) {
       return this.each(function () {
-        let data    = $(this).data(DATA_KEY)
-        let _config = $.extend(
+        let data      = $(this).data(DATA_KEY)
+        const _config = $.extend(
           {},
           Modal.Default,
           $(this).data(),
@@ -480,20 +480,20 @@ const Modal = (($) => {
 
   $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
     let target
-    let selector = Util.getSelectorFromElement(this)
+    const selector = Util.getSelectorFromElement(this)
 
     if (selector) {
       target = $(selector)[0]
     }
 
-    let config = $(target).data(DATA_KEY) ?
+    const config = $(target).data(DATA_KEY) ?
       'toggle' : $.extend({}, $(target).data(), $(this).data())
 
     if (this.tagName === 'A') {
       event.preventDefault()
     }
 
-    let $target = $(target).one(Event.SHOW, (showEvent) => {
+    const $target = $(target).one(Event.SHOW, (showEvent) => {
       if (showEvent.isDefaultPrevented()) {
         // only register focus restorer if modal will actually get shown
         return
index 289853b32ab9f2125bd1fb285838db9ff1830592..01804eda6c63ab50f8b45c108a7db2f8e0a68450 100644 (file)
@@ -107,11 +107,11 @@ const Popover = (($) => {
     }
 
     getTipElement() {
-      return (this.tip = this.tip || $(this.config.template)[0])
+      return this.tip = this.tip || $(this.config.template)[0]
     }
 
     setContent() {
-      let $tip = $(this.getTipElement())
+      const $tip = $(this.getTipElement())
 
       // we use append for html objects to maintain js events
       this.setElementContent($tip.find(Selector.TITLE), this.getTitle())
@@ -138,8 +138,8 @@ const Popover = (($) => {
 
     static _jQueryInterface(config) {
       return this.each(function () {
-        let data   = $(this).data(DATA_KEY)
-        let _config = typeof config === 'object' ? config : null
+        let data      = $(this).data(DATA_KEY)
+        const _config = typeof config === 'object' ? config : null
 
         if (!data && /destroy|hide/.test(config)) {
           return
index 648173b33b6de1a5a4789ba9b6e62fe397a57bd4..98582f91820e0cdc350c389ae1f698339cb76310 100644 (file)
@@ -108,13 +108,13 @@ const ScrollSpy = (($) => {
     // public
 
     refresh() {
-      let autoMethod = this._scrollElement !== this._scrollElement.window ?
+      const autoMethod = this._scrollElement !== this._scrollElement.window ?
         OffsetMethod.POSITION : OffsetMethod.OFFSET
 
-      let offsetMethod = this._config.method === 'auto' ?
+      const offsetMethod = this._config.method === 'auto' ?
         autoMethod : this._config.method
 
-      let offsetBase = offsetMethod === OffsetMethod.POSITION ?
+      const offsetBase = offsetMethod === OffsetMethod.POSITION ?
         this._getScrollTop() : 0
 
       this._offsets = []
@@ -122,12 +122,12 @@ const ScrollSpy = (($) => {
 
       this._scrollHeight = this._getScrollHeight()
 
-      let targets = $.makeArray($(this._selector))
+      const targets = $.makeArray($(this._selector))
 
       targets
         .map((element) => {
           let target
-          let targetSelector = Util.getSelectorFromElement(element)
+          const targetSelector = Util.getSelectorFromElement(element)
 
           if (targetSelector) {
             target = $(targetSelector)[0]
@@ -197,9 +197,9 @@ const ScrollSpy = (($) => {
     }
 
     _process() {
-      let scrollTop    = this._getScrollTop() + this._config.offset
-      let scrollHeight = this._getScrollHeight()
-      let maxScroll    = this._config.offset
+      const scrollTop    = this._getScrollTop() + this._config.offset
+      const scrollHeight = this._getScrollHeight()
+      const maxScroll    = this._config.offset
         + scrollHeight
         - this._scrollElement.offsetHeight
 
@@ -208,7 +208,7 @@ const ScrollSpy = (($) => {
       }
 
       if (scrollTop >= maxScroll) {
-        let target = this._targets[this._targets.length - 1]
+        const target = this._targets[this._targets.length - 1]
 
         if (this._activeTarget !== target) {
           this._activate(target)
@@ -222,7 +222,7 @@ const ScrollSpy = (($) => {
       }
 
       for (let i = this._offsets.length; i--;) {
-        let isActiveTarget = this._activeTarget !== this._targets[i]
+        const isActiveTarget = this._activeTarget !== this._targets[i]
             && scrollTop >= this._offsets[i]
             && (this._offsets[i + 1] === undefined ||
                 scrollTop < this._offsets[i + 1])
@@ -244,7 +244,7 @@ const ScrollSpy = (($) => {
                `${selector}[href="${target}"]`
       })
 
-      let $link = $(queries.join(','))
+      const $link = $(queries.join(','))
 
       if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
         $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE)
@@ -269,8 +269,8 @@ const ScrollSpy = (($) => {
 
     static _jQueryInterface(config) {
       return this.each(function () {
-        let data    = $(this).data(DATA_KEY)
-        let _config = typeof config === 'object' && config || null
+        let data      = $(this).data(DATA_KEY)
+        const _config = typeof config === 'object' && config
 
         if (!data) {
           data = new ScrollSpy(this, _config)
@@ -297,10 +297,10 @@ const ScrollSpy = (($) => {
    */
 
   $(window).on(Event.LOAD_DATA_API, () => {
-    let scrollSpys = $.makeArray($(Selector.DATA_SPY))
+    const scrollSpys = $.makeArray($(Selector.DATA_SPY))
 
     for (let i = scrollSpys.length; i--;) {
-      let $spy = $(scrollSpys[i])
+      const $spy = $(scrollSpys[i])
       ScrollSpy._jQueryInterface.call($spy, $spy.data())
     }
   })
index 012d2f76fc63e5c3108650566b7df0398615b20f..c5d205bcface2aed92e61d4b2565fbb1e52e74e8 100644 (file)
@@ -78,26 +78,26 @@ const Tab = (($) => {
 
     show() {
       if (this._element.parentNode &&
-         (this._element.parentNode.nodeType === Node.ELEMENT_NODE) &&
-         ($(this._element).hasClass(ClassName.ACTIVE))) {
+          this._element.parentNode.nodeType === Node.ELEMENT_NODE &&
+          $(this._element).hasClass(ClassName.ACTIVE)) {
         return
       }
 
       let target
       let previous
-      let listElement = $(this._element).closest(Selector.LIST)[0]
-      let selector  = Util.getSelectorFromElement(this._element)
+      const listElement = $(this._element).closest(Selector.LIST)[0]
+      const selector    = Util.getSelectorFromElement(this._element)
 
       if (listElement) {
         previous = $.makeArray($(listElement).find(Selector.ACTIVE))
         previous = previous[previous.length - 1]
       }
 
-      let hideEvent = $.Event(Event.HIDE, {
+      const hideEvent = $.Event(Event.HIDE, {
         relatedTarget: this._element
       })
 
-      let showEvent = $.Event(Event.SHOW, {
+      const showEvent = $.Event(Event.SHOW, {
         relatedTarget: previous
       })
 
@@ -108,7 +108,7 @@ const Tab = (($) => {
       $(this._element).trigger(showEvent)
 
       if (showEvent.isDefaultPrevented() ||
-         (hideEvent.isDefaultPrevented())) {
+         hideEvent.isDefaultPrevented()) {
         return
       }
 
@@ -121,12 +121,12 @@ const Tab = (($) => {
         listElement
       )
 
-      let complete = () => {
-        let hiddenEvent = $.Event(Event.HIDDEN, {
+      const complete = () => {
+        const hiddenEvent = $.Event(Event.HIDDEN, {
           relatedTarget: this._element
         })
 
-        let shownEvent  = $.Event(Event.SHOWN, {
+        const shownEvent = $.Event(Event.SHOWN, {
           relatedTarget: previous
         })
 
@@ -150,13 +150,13 @@ const Tab = (($) => {
     // private
 
     _activate(element, container, callback) {
-      let active          = $(container).find(Selector.ACTIVE_CHILD)[0]
-      let isTransitioning = callback
+      const active          = $(container).find(Selector.ACTIVE_CHILD)[0]
+      const isTransitioning = callback
         && Util.supportsTransitionEnd()
-        && ((active && $(active).hasClass(ClassName.FADE))
+        && (active && $(active).hasClass(ClassName.FADE)
            || Boolean($(container).find(Selector.FADE_CHILD)[0]))
 
-      let complete = () => this._transitionComplete(
+      const complete = () => this._transitionComplete(
         element,
         active,
         isTransitioning,
@@ -181,7 +181,7 @@ const Tab = (($) => {
       if (active) {
         $(active).removeClass(ClassName.ACTIVE)
 
-        let dropdownChild = $(active).find(
+        const dropdownChild = $(active).find(
           Selector.DROPDOWN_ACTIVE_CHILD
         )[0]
 
@@ -203,9 +203,9 @@ const Tab = (($) => {
       }
 
       if (element.parentNode &&
-         ($(element.parentNode).hasClass(ClassName.DROPDOWN_MENU))) {
+          $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
 
-        let dropdownElement = $(element).closest(Selector.DROPDOWN)[0]
+        const dropdownElement = $(element).closest(Selector.DROPDOWN)[0]
         if (dropdownElement) {
           $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE)
         }
@@ -223,11 +223,11 @@ const Tab = (($) => {
 
     static _jQueryInterface(config) {
       return this.each(function () {
-        let $this = $(this)
-        let data  = $this.data(DATA_KEY)
+        const $this = $(this)
+        let data    = $this.data(DATA_KEY)
 
         if (!data) {
-          data = data = new Tab(this)
+          data = new Tab(this)
           $this.data(DATA_KEY, data)
         }
 
index c4fdbff59c66dda508309908fbcc85a20cb0ab5e..822ae3652500d276b802c5f642cd3cf7ac794e87 100644 (file)
@@ -121,11 +121,11 @@ const Tooltip = (($) => {
     constructor(element, config) {
 
       // private
-      this._isEnabled      = true
-      this._timeout        = 0
-      this._hoverState     = ''
-      this._activeTrigger  = {}
-      this._tether         = null
+      this._isEnabled     = true
+      this._timeout       = 0
+      this._hoverState    = ''
+      this._activeTrigger = {}
+      this._tether        = null
 
       // protected
       this.element = element
@@ -184,7 +184,7 @@ const Tooltip = (($) => {
 
     toggle(event) {
       if (event) {
-        let dataKey = this.constructor.DATA_KEY
+        const dataKey = this.constructor.DATA_KEY
         let context = $(event.currentTarget).data(dataKey)
 
         if (!context) {
@@ -227,11 +227,11 @@ const Tooltip = (($) => {
         $(this.tip).remove()
       }
 
-      this._isEnabled      = null
-      this._timeout        = null
-      this._hoverState     = null
-      this._activeTrigger  = null
-      this._tether         = null
+      this._isEnabled     = null
+      this._timeout       = null
+      this._hoverState    = null
+      this._activeTrigger = null
+      this._tether        = null
 
       this.element = null
       this.config  = null
@@ -242,12 +242,12 @@ const Tooltip = (($) => {
       if ($(this.element).css('display') === 'none') {
         throw new Error('Please use show on visible elements')
       }
-      let showEvent = $.Event(this.constructor.Event.SHOW)
+      const showEvent = $.Event(this.constructor.Event.SHOW)
 
       if (this.isWithContent() && this._isEnabled) {
         $(this.element).trigger(showEvent)
 
-        let isInTheDom = $.contains(
+        const isInTheDom = $.contains(
           this.element.ownerDocument.documentElement,
           this.element
         )
@@ -256,8 +256,8 @@ const Tooltip = (($) => {
           return
         }
 
-        let tip   = this.getTipElement()
-        let tipId = Util.getUID(this.constructor.NAME)
+        const tip   = this.getTipElement()
+        const tipId = Util.getUID(this.constructor.NAME)
 
         tip.setAttribute('id', tipId)
         this.element.setAttribute('aria-describedby', tipId)
@@ -268,11 +268,11 @@ const Tooltip = (($) => {
           $(tip).addClass(ClassName.FADE)
         }
 
-        let placement  = typeof this.config.placement === 'function' ?
+        const placement  = typeof this.config.placement === 'function' ?
           this.config.placement.call(this, tip, this.element) :
           this.config.placement
 
-        let attachment = this._getAttachment(placement)
+        const attachment = this._getAttachment(placement)
 
         $(tip)
           .data(this.constructor.DATA_KEY, this)
@@ -296,9 +296,9 @@ const Tooltip = (($) => {
 
         $(tip).addClass(ClassName.ACTIVE)
 
-        let complete = () => {
-          let prevHoverState = this._hoverState
-          this._hoverState   = null
+        const complete = () => {
+          const prevHoverState = this._hoverState
+          this._hoverState     = null
 
           $(this.element).trigger(this.constructor.Event.SHOWN)
 
@@ -319,9 +319,9 @@ const Tooltip = (($) => {
     }
 
     hide(callback) {
-      let tip       = this.getTipElement()
-      let hideEvent = $.Event(this.constructor.Event.HIDE)
-      let complete  = () => {
+      const tip       = this.getTipElement()
+      const hideEvent = $.Event(this.constructor.Event.HIDE)
+      const complete  = () => {
         if (this._hoverState !== HoverState.ACTIVE && tip.parentNode) {
           tip.parentNode.removeChild(tip)
         }
@@ -344,7 +344,7 @@ const Tooltip = (($) => {
       $(tip).removeClass(ClassName.ACTIVE)
 
       if (Util.supportsTransitionEnd() &&
-         ($(this.tip).hasClass(ClassName.FADE))) {
+          $(this.tip).hasClass(ClassName.FADE)) {
 
         $(tip)
           .one(Util.TRANSITION_END, complete)
@@ -365,11 +365,11 @@ const Tooltip = (($) => {
     }
 
     getTipElement() {
-      return (this.tip = this.tip || $(this.config.template)[0])
+      return this.tip = this.tip || $(this.config.template)[0]
     }
 
     setContent() {
-      let $tip = $(this.getTipElement())
+      const $tip = $(this.getTipElement())
 
       this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle())
 
@@ -381,7 +381,7 @@ const Tooltip = (($) => {
     }
 
     setElementContent($element, content) {
-      let html = this.config.html
+      const html = this.config.html
       if (typeof content === 'object' && (content.nodeType || content.jquery)) {
         // content is a DOM node or a jQuery
         if (html) {
@@ -422,7 +422,7 @@ const Tooltip = (($) => {
     }
 
     _setListeners() {
-      let triggers = this.config.trigger.split(' ')
+      const triggers = this.config.trigger.split(' ')
 
       triggers.forEach((trigger) => {
         if (trigger === 'click') {
@@ -433,10 +433,10 @@ const Tooltip = (($) => {
           )
 
         } else if (trigger !== Trigger.MANUAL) {
-          let eventIn  = trigger === Trigger.HOVER ?
+          const eventIn  = trigger === Trigger.HOVER ?
             this.constructor.Event.MOUSEENTER :
             this.constructor.Event.FOCUSIN
-          let eventOut = trigger === Trigger.HOVER ?
+          const eventOut = trigger === Trigger.HOVER ?
             this.constructor.Event.MOUSELEAVE :
             this.constructor.Event.FOCUSOUT
 
@@ -465,9 +465,9 @@ const Tooltip = (($) => {
     }
 
     _fixTitle() {
-      let titleType = typeof this.element.getAttribute('data-original-title')
+      const titleType = typeof this.element.getAttribute('data-original-title')
       if (this.element.getAttribute('title') ||
-         (titleType !== 'string')) {
+         titleType !== 'string') {
         this.element.setAttribute(
           'data-original-title',
           this.element.getAttribute('title') || ''
@@ -477,7 +477,7 @@ const Tooltip = (($) => {
     }
 
     _enter(event, context) {
-      let dataKey = this.constructor.DATA_KEY
+      const dataKey = this.constructor.DATA_KEY
 
       context = context || $(event.currentTarget).data(dataKey)
 
@@ -496,7 +496,7 @@ const Tooltip = (($) => {
       }
 
       if ($(context.getTipElement()).hasClass(ClassName.ACTIVE) ||
-         (context._hoverState === HoverState.ACTIVE)) {
+         context._hoverState === HoverState.ACTIVE) {
         context._hoverState = HoverState.ACTIVE
         return
       }
@@ -518,7 +518,7 @@ const Tooltip = (($) => {
     }
 
     _leave(event, context) {
-      let dataKey = this.constructor.DATA_KEY
+      const dataKey = this.constructor.DATA_KEY
 
       context = context || $(event.currentTarget).data(dataKey)
 
@@ -557,7 +557,7 @@ const Tooltip = (($) => {
     }
 
     _isWithActiveTrigger() {
-      for (let trigger in this._activeTrigger) {
+      for (const trigger in this._activeTrigger) {
         if (this._activeTrigger[trigger]) {
           return true
         }
@@ -591,10 +591,10 @@ const Tooltip = (($) => {
     }
 
     _getDelegateConfig() {
-      let config = {}
+      const config = {}
 
       if (this.config) {
-        for (let key in this.config) {
+        for (const key in this.config) {
           if (this.constructor.Default[key] !== this.config[key]) {
             config[key] = this.config[key]
           }
@@ -609,9 +609,8 @@ const Tooltip = (($) => {
 
     static _jQueryInterface(config) {
       return this.each(function () {
-        let data   = $(this).data(DATA_KEY)
-        let _config = typeof config === 'object' ?
-          config : null
+        let data      = $(this).data(DATA_KEY)
+        const _config = typeof config === 'object' && config
 
         if (!data && /dispose|hide/.test(config)) {
           return
index 5ddbbbf1335628b11f0ed698874e7f028bd635dc..06424fbfe3fd47e29efdf3e986605fce78e14f4b 100644 (file)
@@ -27,7 +27,7 @@ const Util = (($) => {
 
   // shoutout AngusCroll (https://goo.gl/pxwQGp)
   function toType(obj) {
-    return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
+    return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
   }
 
   function isElement(obj) {
@@ -52,11 +52,13 @@ const Util = (($) => {
       return false
     }
 
-    let el = document.createElement('bootstrap')
+    const el = document.createElement('bootstrap')
 
-    for (let name in TransitionEndEvent) {
+    for (const name in TransitionEndEvent) {
       if (el.style[name] !== undefined) {
-        return { end: TransitionEndEvent[name] }
+        return {
+          end: TransitionEndEvent[name]
+        }
       }
     }
 
@@ -96,15 +98,14 @@ const Util = (($) => {
    * --------------------------------------------------------------------------
    */
 
-  let Util = {
+  const Util = {
 
     TRANSITION_END: 'bsTransitionEnd',
 
     getUID(prefix) {
       do {
-        /* eslint-disable no-bitwise */
+        // eslint-disable-next-line no-bitwise
         prefix += ~~(Math.random() * MAX_UID) // "~~" acts like a faster Math.floor() here
-        /* eslint-enable no-bitwise */
       } while (document.getElementById(prefix))
       return prefix
     },
@@ -133,17 +134,12 @@ const Util = (($) => {
     },
 
     typeCheckConfig(componentName, config, configTypes) {
-      for (let property in configTypes) {
+      for (const property in configTypes) {
         if (configTypes.hasOwnProperty(property)) {
-          let expectedTypes = configTypes[property]
-          let value         = config[property]
-          let valueType
-
-          if (value && isElement(value)) {
-            valueType = 'element'
-          } else {
-            valueType = toType(value)
-          }
+          const expectedTypes = configTypes[property]
+          const value         = config[property]
+          const valueType     = value && isElement(value) ?
+                                'element' : toType(value)
 
           if (!new RegExp(expectedTypes).test(valueType)) {
             throw new Error(
index 3128e20be33ce9ca2d1ff8356ce45e1f5d5bc4df..9548c3318c33ea337c093d7052aeb225b768abf7 100644 (file)
@@ -1,5 +1,5 @@
 $(function () {
-  'use strict';
+  'use strict'
 
   QUnit.module('alert plugin')
 
index 5648506cf5745fdfa98001da637319b03b5bc5e8..7fd86e13a56294ddef024e12af0ab0a60dd5f337 100644 (file)
@@ -1,5 +1,5 @@
 $(function () {
-  'use strict';
+  'use strict'
 
   QUnit.module('button plugin')
 
index d6d0186e15d0dc2b0d6486bb34dc6eb97b6f8965..033ccfd6c5c1e4724be95be150355b48dd140b45 100644 (file)
@@ -1,5 +1,5 @@
 $(function () {
-  'use strict';
+  'use strict'
 
   QUnit.module('carousel plugin')
 
index 25bb7772e2675ab82592a6131b340d7a84754085..7db69e2cf883fd4516d449c233f54a6791eb8f84 100644 (file)
@@ -1,5 +1,5 @@
 $(function () {
-  'use strict';
+  'use strict'
 
   QUnit.module('collapse plugin')
 
@@ -56,14 +56,14 @@ $(function () {
     assert.expect(2)
     var html = [
       '<div class="panel-group" id="accordion1">',
-        '<div class="panel">',
-          '<div id="collapse1" class="collapse"/>',
-        '</div>',
+      '<div class="panel">',
+      '<div id="collapse1" class="collapse"/>',
+      '</div>',
       '</div>',
       '<div class="panel-group" id="accordion2">',
-        '<div class="panel">',
-          '<div id="collapse2" class="collapse active"/>',
-        '</div>',
+      '<div class="panel">',
+      '<div id="collapse2" class="collapse active"/>',
+      '</div>',
       '</div>'
     ].join('')
     $(html).appendTo('#qunit-fixture')
index becd1d08981599647d79a2d616349a23b339bbe1..7e8ecae4ead99fc6eef2c27c8cb0b8c57a3d17d7 100644 (file)
@@ -1,5 +1,5 @@
 $(function () {
-  'use strict';
+  'use strict'
 
   QUnit.module('dropdowns plugin')
 
index f5157d454497b0a3704afdec067c7a93ce01df73..2d5911af3b4b9d3075ba6196a9ddca4877385c52 100644 (file)
@@ -1,5 +1,5 @@
 $(function () {
-  'use strict';
+  'use strict'
 
   QUnit.module('modal plugin')
 
@@ -374,7 +374,7 @@ $(function () {
         var paddingRight = parseInt($(document.body).css('padding-right'), 10)
         assert.strictEqual(isNaN(paddingRight), false)
         assert.strictEqual(paddingRight !== 0, true)
-        $(document.body).css('padding-right', ''); // Because test case "should ignore other inline styles when trying to restore body padding after closing" fail if not
+        $(document.body).css('padding-right', '') // Because test case "should ignore other inline styles when trying to restore body padding after closing" fail if not
         done()
       })
       .bootstrapModal('show')
index 525aea00246b4b7938ae099999685df18c6f29bf..eea7486a43e71739c295a4b369f0c6f35e756b2d 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 (function () {
-  'use strict';
+  'use strict'
 
   // Don't re-order tests.
   QUnit.config.reorder = false
   })
 
 }())
-
-
-// bind polyfill
-// shoutout mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Polyfill
-
-if (!Function.prototype.bind) {
-  Function.prototype.bind = function (oThis) {
-    if (typeof this !== 'function') {
-      // closest thing possible to the ECMAScript 5
-      // internal IsCallable function
-      throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
-    }
-
-    var aArgs   = Array.prototype.slice.call(arguments, 1)
-    var fToBind = this
-    var FNOP    = function () {}
-    var fBound  = function () {
-      return fToBind.apply(this instanceof FNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)))
-    }
-
-    if (this.prototype) {
-      // native functions don't have a prototype
-      FNOP.prototype = this.prototype
-    }
-    fBound.prototype = new FNOP()
-
-    return fBound
-  }
-}
index 6e47222f14ce9e8b7f9fb79237fa722af5927ce6..4667d9e9a7614e1540738c1b1b4426b3d7e5588d 100644 (file)
@@ -1,5 +1,5 @@
 $(function () {
-  'use strict';
+  'use strict'
 
   QUnit.module('popover plugin')
 
index 97ddd16ece16fe5e33b64fe7e1df3a3b3867b9a8..a349b5337ee2aafaf2a10ad2cddcc9b3abb82a51 100644 (file)
@@ -1,5 +1,5 @@
 $(function () {
-  'use strict';
+  'use strict'
 
   QUnit.module('scrollspy plugin')
 
@@ -231,8 +231,8 @@ $(function () {
       .appendTo('#qunit-fixture')
       .bootstrapScrollspy({ offset: 0, target: '#navigation' })
 
-    !function testActiveElements() {
-      if (++times > 3) return done()
+    function testActiveElements() {
+      if (++times > 3) { return done() }
 
       $content.one('scroll', function () {
         assert.ok($('#a-1').hasClass('active'), 'nav item for outer element has "active" class')
@@ -241,7 +241,9 @@ $(function () {
       })
 
       $content.scrollTop($content.scrollTop() + 10)
-    }()
+    }
+
+    testActiveElements()
   })
 
   QUnit.test('should clear selection if above the first section', function (assert) {
@@ -399,8 +401,8 @@ $(function () {
       $navbar.appendTo('#qunit-fixture')
       $content.appendTo('#qunit-fixture')
 
-      if (type === 'js') $content.bootstrapScrollspy({ target: '.navbar', offset: 0, method: 'position' })
-      else if (type === 'data') $(window).trigger('load')
+      if (type === 'js') { $content.bootstrapScrollspy({ target: '.navbar', offset: 0, method: 'position' }) }
+      else if (type === 'data') { $(window).trigger('load') }
 
       var $target = $('#div-' + type + 'm-2')
       var scrollspy = $content.data('bs.scrollspy')
index 522ed0b3e488f8921a36c1e63d6d9cd0fed8d7d7..9835002fae5d96858b980ea90a0228cb08af7178 100644 (file)
@@ -1,5 +1,5 @@
 $(function () {
-  'use strict';
+  'use strict'
 
   QUnit.module('tabs plugin')
 
index 97c5855cb08aba99c2724af65c31185333c2e8bd..ea95118a443abd46f4762ba9511af7ac39f6b25f 100644 (file)
@@ -1,5 +1,5 @@
 $(function () {
-  'use strict';
+  'use strict'
 
   QUnit.module('tooltip plugin')
 
@@ -382,7 +382,7 @@ $(function () {
     var $tooltip = $($target.data('bs.tooltip').tip)
 
     // this is some dumb hack stuff because sub pixels in firefox
-    var top = Math.round($target.offset().top + ($target[0].offsetHeight / 2) - ($tooltip[0].offsetHeight / 2))
+    var top = Math.round($target.offset().top + $target[0].offsetHeight / 2 - $tooltip[0].offsetHeight / 2)
     var top2 = Math.round($tooltip.offset().top)
     var topDiff = top - top2
     assert.ok(topDiff <= 1 && topDiff >= -1)
@@ -540,7 +540,7 @@ $(function () {
 
     var $tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"/>')
       .appendTo('#qunit-fixture')
-      .bootstrapTooltip({ delay: { show: 0, hide: 150 }})
+      .bootstrapTooltip({ delay: { show: 0, hide: 150 } })
 
     setTimeout(function () {
       assert.ok($('.tooltip').is('.fade.active'), '1ms: tooltip faded active')
@@ -587,7 +587,7 @@ $(function () {
 
     var $tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"/>')
       .appendTo('#qunit-fixture')
-      .bootstrapTooltip({ delay: { show: 150, hide: 0 }})
+      .bootstrapTooltip({ delay: { show: 150, hide: 0 } })
 
     setTimeout(function () {
       assert.ok(!$('.tooltip').is('.fade.active'), '100ms: tooltip not faded active')
@@ -608,7 +608,7 @@ $(function () {
 
     var $tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"/>')
       .appendTo('#qunit-fixture')
-      .bootstrapTooltip({ delay: { show: 0, hide: 150 }})
+      .bootstrapTooltip({ delay: { show: 0, hide: 150 } })
 
     setTimeout(function () {
       assert.ok($($tooltip.data('bs.tooltip').tip).is('.fade.active'), '1ms: tooltip faded active')
@@ -723,10 +723,10 @@ $(function () {
     $('#tt-outer').trigger('mouseleave')
     assert.strictEqual(currentUid, $('#tt-content').text())
 
-    assert.ok(obj._hoverState == 'out', 'the tooltip hoverState should be set to "out"')
+    assert.ok(obj._hoverState === 'out', 'the tooltip hoverState should be set to "out"')
 
     $('#tt-outer').trigger('mouseenter')
-    assert.ok(obj._hoverState == 'active', 'the tooltip hoverState should be set to "active"')
+    assert.ok(obj._hoverState === 'active', 'the tooltip hoverState should be set to "active"')
 
     assert.strictEqual(currentUid, $('#tt-content').text())
   })
@@ -788,7 +788,7 @@ $(function () {
     var tooltip = $el.data('bs.tooltip')
     var $tooltip = $(tooltip.getTipElement())
 
-    function showingTooltip() { return $tooltip.hasClass('active') || tooltip._hoverState == 'active' }
+    function showingTooltip() { return $tooltip.hasClass('active') || tooltip._hoverState === 'active' }
 
     var tests = [
         ['mouseenter', 'mouseleave'],
@@ -812,8 +812,8 @@ $(function () {
 
     $.each(tests, function (idx, triggers) {
       for (var i = 0, len = triggers.length; i < len; i++) {
-        $el.trigger(triggers[i]);
-        assert.equal(i < (len - 1), showingTooltip())
+        $el.trigger(triggers[i])
+        assert.equal(i < len - 1, showingTooltip())
       }
     })
   })