1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-15 01:55:46 +02:00
This commit is contained in:
Mark Otto
2018-01-11 22:42:40 -08:00
parent 80d0943b95
commit 6d8d8639f3
42 changed files with 356 additions and 385 deletions

14
js/dist/scrollspy.js vendored
View File

@@ -84,16 +84,16 @@ var ScrollSpy = function ($) {
this.refresh();
this._process();
} // getters
} // Getters
var _proto = ScrollSpy.prototype;
// public
// Public
_proto.refresh = function refresh() {
var _this2 = this;
var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
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 = [];
@@ -112,7 +112,7 @@ var ScrollSpy = function ($) {
var targetBCR = target.getBoundingClientRect();
if (targetBCR.width || targetBCR.height) {
// todo (fat): remove sketch reliance on jQuery position/offset
// TODO (fat): remove sketch reliance on jQuery position/offset
return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
}
}
@@ -140,7 +140,7 @@ var ScrollSpy = function ($) {
this._targets = null;
this._activeTarget = null;
this._scrollHeight = null;
}; // private
}; // Private
_proto._getConfig = function _getConfig(config) {
@@ -244,7 +244,7 @@ var ScrollSpy = function ($) {
_proto._clear = function _clear() {
$(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
}; // static
}; // Static
ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
@@ -260,7 +260,7 @@ var ScrollSpy = function ($) {
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new Error("No method named \"" + config + "\"");
throw new TypeError("No method named \"" + config + "\"");
}
data[config]();