scrollspy.js 14.8 KB
Newer Older
XhmikosR's avatar
Dist    
XhmikosR committed
1
/*!
XhmikosR's avatar
XhmikosR committed
2
  * Bootstrap scrollspy.js v4.3.1 (https://getbootstrap.com/)
Mark Otto's avatar
Mark Otto committed
3
  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
XhmikosR's avatar
Dist    
XhmikosR committed
4
5
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  */
Mark Otto's avatar
dist    
Mark Otto committed
6
(function (global, factory) {
7
8
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/data.js'), require('../dom/event-handler.js'), require('../dom/manipulator.js'), require('../dom/selector-engine.js')) :
  typeof define === 'function' && define.amd ? define(['../dom/data.js', '../dom/event-handler.js', '../dom/manipulator.js', '../dom/selector-engine.js'], factory) :
XhmikosR's avatar
XhmikosR committed
9
10
  (global = global || self, global.ScrollSpy = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
}(this, function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
Mark Otto's avatar
dist    
Mark Otto committed
11

XhmikosR's avatar
XhmikosR committed
12
13
14
15
  Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
  EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
  Manipulator = Manipulator && Manipulator.hasOwnProperty('default') ? Manipulator['default'] : Manipulator;
  SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
Mark Otto's avatar
dist    
Mark Otto committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

  function _defineProperties(target, props) {
    for (var i = 0; i < props.length; i++) {
      var descriptor = props[i];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor) descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }

  function _createClass(Constructor, protoProps, staticProps) {
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
    if (staticProps) _defineProperties(Constructor, staticProps);
    return Constructor;
  }

  function _defineProperty(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
  function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      if (enumerableOnly) symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      });
      keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread2(target) {
Mark Otto's avatar
dist    
Mark Otto committed
63
64
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i] != null ? arguments[i] : {};
Mark Otto's avatar
dist    
Mark Otto committed
65

66
67
68
69
70
71
72
73
74
75
      if (i % 2) {
        ownKeys(source, true).forEach(function (key) {
          _defineProperty(target, key, source[key]);
        });
      } else if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
      } else {
        ownKeys(source).forEach(function (key) {
          Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
Mark Otto's avatar
dist    
Mark Otto committed
76
77
      }
    }
Mark Otto's avatar
dist    
Mark Otto committed
78

Mark Otto's avatar
dist    
Mark Otto committed
79
80
    return target;
  }
fat's avatar
fat committed
81

XhmikosR's avatar
XhmikosR committed
82
83
84
85
86
87
88
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.3.1): util/index.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  var MAX_UID = 1000000;
XhmikosR's avatar
Dist.    
XhmikosR committed
89
90
  var _window = window,
      jQuery = _window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
XhmikosR's avatar
XhmikosR committed
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

  var toType = function toType(obj) {
    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  };
  /**
   * --------------------------------------------------------------------------
   * Public Util Api
   * --------------------------------------------------------------------------
   */


  var getUID = function getUID(prefix) {
    do {
      // eslint-disable-next-line no-bitwise
      prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
    } while (document.getElementById(prefix));

    return prefix;
  };

  var getSelectorFromElement = function getSelectorFromElement(element) {
    var selector = element.getAttribute('data-target');

    if (!selector || selector === '#') {
      var hrefAttr = element.getAttribute('href');
      selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
    }

    try {
      return document.querySelector(selector) ? selector : null;
XhmikosR's avatar
Dist.    
XhmikosR committed
121
    } catch (error) {
XhmikosR's avatar
XhmikosR committed
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
      return null;
    }
  };

  var isElement = function isElement(obj) {
    return (obj[0] || obj).nodeType;
  };

  var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
    Object.keys(configTypes).forEach(function (property) {
      var expectedTypes = configTypes[property];
      var value = config[property];
      var valueType = value && isElement(value) ? 'element' : toType(value);

      if (!new RegExp(expectedTypes).test(valueType)) {
        throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
      }
    });
  };

  var makeArray = function makeArray(nodeList) {
    if (!nodeList) {
      return [];
    }

    return [].slice.call(nodeList);
  };

XhmikosR's avatar
Dist    
XhmikosR committed
150
151
152
153
154
155
156
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME = 'scrollspy';
XhmikosR's avatar
XhmikosR committed
157
  var VERSION = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
  var DATA_KEY = 'bs.scrollspy';
  var EVENT_KEY = "." + DATA_KEY;
  var DATA_API_KEY = '.data-api';
  var Default = {
    offset: 10,
    method: 'auto',
    target: ''
  };
  var DefaultType = {
    offset: 'number',
    method: 'string',
    target: '(string|element)'
  };
  var Event = {
    ACTIVATE: "activate" + EVENT_KEY,
    SCROLL: "scroll" + EVENT_KEY,
    LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY
  };
  var ClassName = {
    DROPDOWN_ITEM: 'dropdown-item',
    ACTIVE: 'active'
  };
  var Selector = {
    DATA_SPY: '[data-spy="scroll"]',
    NAV_LIST_GROUP: '.nav, .list-group',
    NAV_LINKS: '.nav-link',
    NAV_ITEMS: '.nav-item',
    LIST_ITEMS: '.list-group-item',
    DROPDOWN: '.dropdown',
    DROPDOWN_TOGGLE: '.dropdown-toggle'
  };
  var OffsetMethod = {
    OFFSET: 'offset',
    POSITION: 'position'
Mark Otto's avatar
dist    
Mark Otto committed
192
193
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
194
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
195
196
     * ------------------------------------------------------------------------
     */
fat's avatar
fat committed
197

XhmikosR's avatar
Dist    
XhmikosR committed
198
199
200
201
202
203
204
205
206
207
208
  };

  var ScrollSpy =
  /*#__PURE__*/
  function () {
    function ScrollSpy(element, config) {
      var _this = this;

      this._element = element;
      this._scrollElement = element.tagName === 'BODY' ? window : element;
      this._config = this._getConfig(config);
XhmikosR's avatar
Dist.    
XhmikosR committed
209
      this._selector = this._config.target + " " + Selector.NAV_LINKS + "," + (this._config.target + " " + Selector.LIST_ITEMS + ",") + (this._config.target + " ." + ClassName.DROPDOWN_ITEM);
XhmikosR's avatar
Dist    
XhmikosR committed
210
211
212
213
      this._offsets = [];
      this._targets = [];
      this._activeTarget = null;
      this._scrollHeight = 0;
XhmikosR's avatar
XhmikosR committed
214
      EventHandler.on(this._scrollElement, Event.SCROLL, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
215
216
217
        return _this._process(event);
      });
      this.refresh();
Jacob Thornton's avatar
Jacob Thornton committed
218

XhmikosR's avatar
Dist    
XhmikosR committed
219
      this._process();
XhmikosR's avatar
XhmikosR committed
220
221

      Data.setData(element, DATA_KEY, this);
XhmikosR's avatar
Dist    
XhmikosR committed
222
    } // Getters
fat's avatar
fat committed
223
224


XhmikosR's avatar
Dist    
XhmikosR committed
225
    var _proto = ScrollSpy.prototype;
fat's avatar
fat committed
226

XhmikosR's avatar
Dist    
XhmikosR committed
227
228
229
    // Public
    _proto.refresh = function refresh() {
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
230

XhmikosR's avatar
Dist    
XhmikosR committed
231
232
233
234
235
236
      var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
      var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
      var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
      this._offsets = [];
      this._targets = [];
      this._scrollHeight = this._getScrollHeight();
XhmikosR's avatar
XhmikosR committed
237
      var targets = makeArray(SelectorEngine.find(this._selector));
XhmikosR's avatar
Dist    
XhmikosR committed
238
239
      targets.map(function (element) {
        var target;
XhmikosR's avatar
XhmikosR committed
240
        var targetSelector = getSelectorFromElement(element);
Mark Otto's avatar
dist    
Mark Otto committed
241

XhmikosR's avatar
Dist    
XhmikosR committed
242
        if (targetSelector) {
XhmikosR's avatar
XhmikosR committed
243
          target = SelectorEngine.findOne(targetSelector);
XhmikosR's avatar
Dist    
XhmikosR committed
244
        }
245

XhmikosR's avatar
Dist    
XhmikosR committed
246
247
        if (target) {
          var targetBCR = target.getBoundingClientRect();
fat's avatar
fat committed
248

XhmikosR's avatar
Dist    
XhmikosR committed
249
          if (targetBCR.width || targetBCR.height) {
XhmikosR's avatar
XhmikosR committed
250
            return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
Mark Otto's avatar
dist    
Mark Otto committed
251
          }
XhmikosR's avatar
Dist    
XhmikosR committed
252
        }
fat's avatar
fat committed
253

XhmikosR's avatar
Dist    
XhmikosR committed
254
255
256
257
258
259
260
        return null;
      }).filter(function (item) {
        return item;
      }).sort(function (a, b) {
        return a[0] - b[0];
      }).forEach(function (item) {
        _this2._offsets.push(item[0]);
fat's avatar
fat committed
261

XhmikosR's avatar
Dist    
XhmikosR committed
262
263
264
        _this2._targets.push(item[1]);
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
265

XhmikosR's avatar
Dist    
XhmikosR committed
266
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
267
268
      Data.removeData(this._element, DATA_KEY);
      EventHandler.off(this._scrollElement, EVENT_KEY);
XhmikosR's avatar
Dist    
XhmikosR committed
269
270
271
272
273
274
275
276
      this._element = null;
      this._scrollElement = null;
      this._config = null;
      this._selector = null;
      this._offsets = null;
      this._targets = null;
      this._activeTarget = null;
      this._scrollHeight = null;
Mark Otto's avatar
Mark Otto committed
277
278
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
279
280

    _proto._getConfig = function _getConfig(config) {
281
      config = _objectSpread2({}, Default, {}, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist    
XhmikosR committed
282
283

      if (typeof config.target !== 'string') {
XhmikosR's avatar
XhmikosR committed
284
        var id = config.target.id;
XhmikosR's avatar
Dist    
XhmikosR committed
285
286

        if (!id) {
XhmikosR's avatar
XhmikosR committed
287
288
          id = getUID(NAME);
          config.target.id = id;
Mark Otto's avatar
dist    
Mark Otto committed
289
        }
matus's avatar
matus committed
290

XhmikosR's avatar
Dist    
XhmikosR committed
291
292
        config.target = "#" + id;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
293

XhmikosR's avatar
XhmikosR committed
294
      typeCheckConfig(NAME, config, DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
295
296
      return config;
    };
fat's avatar
fat committed
297

XhmikosR's avatar
Dist    
XhmikosR committed
298
299
300
    _proto._getScrollTop = function _getScrollTop() {
      return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
    };
fat's avatar
fat committed
301

XhmikosR's avatar
Dist    
XhmikosR committed
302
303
304
    _proto._getScrollHeight = function _getScrollHeight() {
      return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
    };
fat's avatar
fat committed
305

XhmikosR's avatar
Dist    
XhmikosR committed
306
307
308
    _proto._getOffsetHeight = function _getOffsetHeight() {
      return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
    };
fat's avatar
fat committed
309

XhmikosR's avatar
Dist    
XhmikosR committed
310
311
    _proto._process = function _process() {
      var scrollTop = this._getScrollTop() + this._config.offset;
fat's avatar
fat committed
312

XhmikosR's avatar
Dist    
XhmikosR committed
313
      var scrollHeight = this._getScrollHeight();
Mark Otto's avatar
dist    
Mark Otto committed
314

XhmikosR's avatar
Dist    
XhmikosR committed
315
      var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
Mark Otto's avatar
dist    
Mark Otto committed
316

XhmikosR's avatar
Dist    
XhmikosR committed
317
318
319
      if (this._scrollHeight !== scrollHeight) {
        this.refresh();
      }
Mark Otto's avatar
dist    
Mark Otto committed
320

XhmikosR's avatar
Dist    
XhmikosR committed
321
322
      if (scrollTop >= maxScroll) {
        var target = this._targets[this._targets.length - 1];
fat's avatar
fat committed
323

XhmikosR's avatar
Dist    
XhmikosR committed
324
325
        if (this._activeTarget !== target) {
          this._activate(target);
Mark Otto's avatar
dist    
Mark Otto committed
326
        }
fat's avatar
fat committed
327

XhmikosR's avatar
Dist    
XhmikosR committed
328
329
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
330

XhmikosR's avatar
Dist    
XhmikosR committed
331
332
      if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
        this._activeTarget = null;
Mark Otto's avatar
dist    
Mark Otto committed
333

XhmikosR's avatar
Dist    
XhmikosR committed
334
        this._clear();
Mark Otto's avatar
dist    
Mark Otto committed
335

XhmikosR's avatar
Dist    
XhmikosR committed
336
337
        return;
      }
fat's avatar
fat committed
338

XhmikosR's avatar
Dist    
XhmikosR committed
339
      var offsetLength = this._offsets.length;
Mark Otto's avatar
dist    
Mark Otto committed
340

XhmikosR's avatar
Dist    
XhmikosR committed
341
342
      for (var i = offsetLength; i--;) {
        var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
Mark Otto's avatar
dist    
Mark Otto committed
343

XhmikosR's avatar
Dist    
XhmikosR committed
344
345
346
347
348
        if (isActiveTarget) {
          this._activate(this._targets[i]);
        }
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
349

XhmikosR's avatar
Dist    
XhmikosR committed
350
351
    _proto._activate = function _activate(target) {
      this._activeTarget = target;
Mark Otto's avatar
dist    
Mark Otto committed
352

XhmikosR's avatar
Dist    
XhmikosR committed
353
      this._clear();
Mark Otto's avatar
dist    
Mark Otto committed
354

XhmikosR's avatar
Dist    
XhmikosR committed
355
356
      var queries = this._selector.split(',').map(function (selector) {
        return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
XhmikosR's avatar
Dist    
XhmikosR committed
357
      });
XhmikosR's avatar
Dist    
XhmikosR committed
358

XhmikosR's avatar
XhmikosR committed
359
      var link = SelectorEngine.findOne(queries.join(','));
Mark Otto's avatar
dist    
Mark Otto committed
360

XhmikosR's avatar
XhmikosR committed
361
362
363
      if (link.classList.contains(ClassName.DROPDOWN_ITEM)) {
        SelectorEngine.findOne(Selector.DROPDOWN_TOGGLE, SelectorEngine.closest(link, Selector.DROPDOWN)).classList.add(ClassName.ACTIVE);
        link.classList.add(ClassName.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
364
365
      } else {
        // Set triggered link as active
XhmikosR's avatar
XhmikosR committed
366
367
368
369
370
371
372
373
374
375
376
377
378
379
        link.classList.add(ClassName.ACTIVE);
        SelectorEngine.parents(link, Selector.NAV_LIST_GROUP).forEach(function (listGroup) {
          // Set triggered links parents as active
          // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
          SelectorEngine.prev(listGroup, Selector.NAV_LINKS + ", " + Selector.LIST_ITEMS).forEach(function (item) {
            return item.classList.add(ClassName.ACTIVE);
          }); // Handle special case when .nav-link is inside .nav-item

          SelectorEngine.prev(listGroup, Selector.NAV_ITEMS).forEach(function (navItem) {
            SelectorEngine.children(navItem, Selector.NAV_LINKS).forEach(function (item) {
              return item.classList.add(ClassName.ACTIVE);
            });
          });
        });
XhmikosR's avatar
Dist    
XhmikosR committed
380
      }
Mark Otto's avatar
grunt    
Mark Otto committed
381

XhmikosR's avatar
XhmikosR committed
382
      EventHandler.trigger(this._scrollElement, Event.ACTIVATE, {
XhmikosR's avatar
Dist    
XhmikosR committed
383
384
385
        relatedTarget: target
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
386

XhmikosR's avatar
Dist    
XhmikosR committed
387
    _proto._clear = function _clear() {
XhmikosR's avatar
XhmikosR committed
388
      makeArray(SelectorEngine.find(this._selector)).filter(function (node) {
XhmikosR's avatar
Dist    
XhmikosR committed
389
390
391
392
        return node.classList.contains(ClassName.ACTIVE);
      }).forEach(function (node) {
        return node.classList.remove(ClassName.ACTIVE);
      });
Mark Otto's avatar
Mark Otto committed
393
394
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
395

XhmikosR's avatar
Dist    
XhmikosR committed
396
397
    ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
398
        var data = Data.getData(this, DATA_KEY);
Mark Otto's avatar
dist    
Mark Otto committed
399

XhmikosR's avatar
Dist    
XhmikosR committed
400
        var _config = typeof config === 'object' && config;
Mark Otto's avatar
dist    
Mark Otto committed
401

XhmikosR's avatar
Dist    
XhmikosR committed
402
403
404
        if (!data) {
          data = new ScrollSpy(this, _config);
        }
Mark Otto's avatar
dist    
Mark Otto committed
405

XhmikosR's avatar
Dist    
XhmikosR committed
406
407
408
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
409
          }
Mark Otto's avatar
dist    
Mark Otto committed
410

XhmikosR's avatar
Dist    
XhmikosR committed
411
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
412
        }
XhmikosR's avatar
Dist    
XhmikosR committed
413
414
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
415

XhmikosR's avatar
XhmikosR committed
416
417
418
419
    ScrollSpy._getInstance = function _getInstance(element) {
      return Data.getData(element, DATA_KEY);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
420
421
422
423
424
425
426
427
428
429
430
    _createClass(ScrollSpy, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default;
      }
    }]);
fat's avatar
fat committed
431

XhmikosR's avatar
Dist    
XhmikosR committed
432
433
434
435
436
437
438
    return ScrollSpy;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
fat's avatar
fat committed
439

Mark Otto's avatar
dist    
Mark Otto committed
440

XhmikosR's avatar
XhmikosR committed
441
442
443
444
  EventHandler.on(window, Event.LOAD_DATA_API, function () {
    makeArray(SelectorEngine.find(Selector.DATA_SPY)).forEach(function (spy) {
      return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
    });
XhmikosR's avatar
Dist    
XhmikosR committed
445
446
447
448
449
450
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
fat's avatar
fat committed
451

452
453
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
454
455
456
457
  if (typeof jQuery !== 'undefined') {
    var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
    jQuery.fn[NAME] = ScrollSpy._jQueryInterface;
    jQuery.fn[NAME].Constructor = ScrollSpy;
Mark Otto's avatar
dist    
Mark Otto committed
458

XhmikosR's avatar
XhmikosR committed
459
460
461
462
463
    jQuery.fn[NAME].noConflict = function () {
      jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
      return ScrollSpy._jQueryInterface;
    };
  }
fat's avatar
fat committed
464
465

  return ScrollSpy;
Mark Otto's avatar
dist    
Mark Otto committed
466

Mark Otto's avatar
Mark Otto committed
467
}));
Mark Otto's avatar
dist    
Mark Otto committed
468
//# sourceMappingURL=scrollspy.js.map