bootstrap 4.0.0.beta → 4.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bootstrap might be problematic. Click here for more details.

Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile +1 -1
  4. data/README.md +10 -43
  5. data/Rakefile +1 -1
  6. data/assets/javascripts/bootstrap-sprockets.js +5 -5
  7. data/assets/javascripts/bootstrap.js +1561 -1542
  8. data/assets/javascripts/bootstrap.min.js +6 -5
  9. data/assets/javascripts/bootstrap/alert.js +31 -38
  10. data/assets/javascripts/bootstrap/button.js +23 -30
  11. data/assets/javascripts/bootstrap/carousel.js +72 -81
  12. data/assets/javascripts/bootstrap/collapse.js +72 -68
  13. data/assets/javascripts/bootstrap/dropdown.js +97 -85
  14. data/assets/javascripts/bootstrap/modal.js +104 -101
  15. data/assets/javascripts/bootstrap/popover.js +55 -68
  16. data/assets/javascripts/bootstrap/scrollspy.js +63 -68
  17. data/assets/javascripts/bootstrap/tab.js +54 -49
  18. data/assets/javascripts/bootstrap/tooltip.js +102 -116
  19. data/assets/javascripts/bootstrap/util.js +20 -30
  20. data/assets/stylesheets/_bootstrap-grid.scss +7 -9
  21. data/assets/stylesheets/_bootstrap-reboot.scss +7 -4
  22. data/assets/stylesheets/_bootstrap.scss +2 -1
  23. data/assets/stylesheets/bootstrap/_alert.scss +4 -3
  24. data/assets/stylesheets/bootstrap/_badge.scss +1 -2
  25. data/assets/stylesheets/bootstrap/_breadcrumb.scss +4 -4
  26. data/assets/stylesheets/bootstrap/_button-group.scss +33 -24
  27. data/assets/stylesheets/bootstrap/_buttons.scss +24 -29
  28. data/assets/stylesheets/bootstrap/_card.scss +58 -22
  29. data/assets/stylesheets/bootstrap/_carousel.scss +6 -0
  30. data/assets/stylesheets/bootstrap/_close.scss +2 -2
  31. data/assets/stylesheets/bootstrap/_custom-forms.scss +11 -8
  32. data/assets/stylesheets/bootstrap/_dropdown.scss +16 -41
  33. data/assets/stylesheets/bootstrap/_forms.scss +12 -44
  34. data/assets/stylesheets/bootstrap/_functions.scss +6 -10
  35. data/assets/stylesheets/bootstrap/_grid.scss +0 -1
  36. data/assets/stylesheets/bootstrap/_input-group.scss +17 -7
  37. data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
  38. data/assets/stylesheets/bootstrap/_modal.scss +12 -1
  39. data/assets/stylesheets/bootstrap/_nav.scss +5 -5
  40. data/assets/stylesheets/bootstrap/_navbar.scss +27 -5
  41. data/assets/stylesheets/bootstrap/_pagination.scss +2 -4
  42. data/assets/stylesheets/bootstrap/_popover.scss +16 -17
  43. data/assets/stylesheets/bootstrap/_print.scss +2 -3
  44. data/assets/stylesheets/bootstrap/_progress.scss +4 -6
  45. data/assets/stylesheets/bootstrap/_reboot.scss +39 -16
  46. data/assets/stylesheets/bootstrap/_root.scss +19 -0
  47. data/assets/stylesheets/bootstrap/_tables.scss +40 -28
  48. data/assets/stylesheets/bootstrap/_tooltip.scss +6 -6
  49. data/assets/stylesheets/bootstrap/_transitions.scss +2 -0
  50. data/assets/stylesheets/bootstrap/_type.scss +2 -0
  51. data/assets/stylesheets/bootstrap/_variables.scss +467 -476
  52. data/assets/stylesheets/bootstrap/mixins/_alert.scss +1 -1
  53. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +8 -0
  54. data/assets/stylesheets/bootstrap/mixins/_badge.scss +2 -2
  55. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +18 -4
  56. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +27 -16
  57. data/assets/stylesheets/bootstrap/mixins/_caret.scss +35 -0
  58. data/assets/stylesheets/bootstrap/mixins/_float.scss +2 -0
  59. data/assets/stylesheets/bootstrap/mixins/_forms.scss +31 -4
  60. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +8 -0
  61. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +14 -1
  62. data/assets/stylesheets/bootstrap/mixins/_grid.scss +10 -5
  63. data/assets/stylesheets/bootstrap/mixins/_hover.scss +13 -12
  64. data/assets/stylesheets/bootstrap/mixins/_image.scss +3 -3
  65. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +0 -2
  66. data/assets/stylesheets/bootstrap/mixins/_navbar-align.scss +2 -1
  67. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +1 -2
  68. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +2 -2
  69. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +2 -0
  70. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +2 -0
  71. data/assets/stylesheets/bootstrap/utilities/_align.scss +2 -0
  72. data/assets/stylesheets/bootstrap/utilities/_background.scss +16 -3
  73. data/assets/stylesheets/bootstrap/utilities/_borders.scss +5 -3
  74. data/assets/stylesheets/bootstrap/utilities/_display.scss +3 -0
  75. data/assets/stylesheets/bootstrap/utilities/_flex.scss +2 -0
  76. data/assets/stylesheets/bootstrap/utilities/_position.scss +12 -1
  77. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +2 -0
  78. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +24 -14
  79. data/assets/stylesheets/bootstrap/utilities/_text.scss +7 -4
  80. data/bootstrap.gemspec +2 -3
  81. data/lib/bootstrap.rb +0 -16
  82. data/lib/bootstrap/version.rb +2 -2
  83. data/tasks/updater/js.rb +31 -4
  84. data/tasks/updater/scss.rb +0 -12
  85. data/test/dummy_rails/config/application.rb +0 -1
  86. metadata +16 -27
  87. data/templates/project/_bootstrap-variables.scss +0 -834
  88. data/templates/project/manifest.rb +0 -18
  89. data/templates/project/styles.scss +0 -10
  90. data/test/compass_test.rb +0 -14
@@ -1,69 +1,56 @@
1
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
1
+ 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); } }
2
2
 
3
- var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
4
4
 
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
-
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
10
6
 
11
7
  /**
12
8
  * --------------------------------------------------------------------------
13
- * Bootstrap (v4.0.0-beta): popover.js
9
+ * Bootstrap (v4.0.0-beta.2): popover.js
14
10
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
15
11
  * --------------------------------------------------------------------------
16
12
  */
17
-
18
- var Popover = function ($) {
19
-
13
+ var Popover = function () {
20
14
  /**
21
15
  * ------------------------------------------------------------------------
22
16
  * Constants
23
17
  * ------------------------------------------------------------------------
24
18
  */
25
-
26
19
  var NAME = 'popover';
27
- var VERSION = '4.0.0-beta';
20
+ var VERSION = '4.0.0-beta.2';
28
21
  var DATA_KEY = 'bs.popover';
29
- var EVENT_KEY = '.' + DATA_KEY;
22
+ var EVENT_KEY = "." + DATA_KEY;
30
23
  var JQUERY_NO_CONFLICT = $.fn[NAME];
31
24
  var CLASS_PREFIX = 'bs-popover';
32
- var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g');
33
-
25
+ var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
34
26
  var Default = $.extend({}, Tooltip.Default, {
35
27
  placement: 'right',
36
28
  trigger: 'click',
37
29
  content: '',
38
30
  template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
39
31
  });
40
-
41
32
  var DefaultType = $.extend({}, Tooltip.DefaultType, {
42
33
  content: '(string|element|function)'
43
34
  });
44
-
45
35
  var ClassName = {
46
36
  FADE: 'fade',
47
37
  SHOW: 'show'
48
38
  };
49
-
50
39
  var Selector = {
51
40
  TITLE: '.popover-header',
52
41
  CONTENT: '.popover-body'
53
42
  };
54
-
55
43
  var Event = {
56
- HIDE: 'hide' + EVENT_KEY,
57
- HIDDEN: 'hidden' + EVENT_KEY,
58
- SHOW: 'show' + EVENT_KEY,
59
- SHOWN: 'shown' + EVENT_KEY,
60
- INSERTED: 'inserted' + EVENT_KEY,
61
- CLICK: 'click' + EVENT_KEY,
62
- FOCUSIN: 'focusin' + EVENT_KEY,
63
- FOCUSOUT: 'focusout' + EVENT_KEY,
64
- MOUSEENTER: 'mouseenter' + EVENT_KEY,
65
- MOUSELEAVE: 'mouseleave' + EVENT_KEY
66
-
44
+ HIDE: "hide" + EVENT_KEY,
45
+ HIDDEN: "hidden" + EVENT_KEY,
46
+ SHOW: "show" + EVENT_KEY,
47
+ SHOWN: "shown" + EVENT_KEY,
48
+ INSERTED: "inserted" + EVENT_KEY,
49
+ CLICK: "click" + EVENT_KEY,
50
+ FOCUSIN: "focusin" + EVENT_KEY,
51
+ FOCUSOUT: "focusout" + EVENT_KEY,
52
+ MOUSEENTER: "mouseenter" + EVENT_KEY,
53
+ MOUSELEAVE: "mouseleave" + EVENT_KEY
67
54
  /**
68
55
  * ------------------------------------------------------------------------
69
56
  * Class Definition
@@ -71,59 +58,60 @@ var Popover = function ($) {
71
58
  */
72
59
 
73
60
  };
74
- var Popover = function (_Tooltip) {
75
- _inherits(Popover, _Tooltip);
76
61
 
77
- function Popover() {
78
- _classCallCheck(this, Popover);
62
+ var Popover =
63
+ /*#__PURE__*/
64
+ function (_Tooltip) {
65
+ _inheritsLoose(Popover, _Tooltip);
79
66
 
80
- return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments));
67
+ function Popover() {
68
+ return _Tooltip.apply(this, arguments) || this;
81
69
  }
82
70
 
83
- // overrides
71
+ var _proto = Popover.prototype;
84
72
 
85
- Popover.prototype.isWithContent = function isWithContent() {
73
+ // overrides
74
+ _proto.isWithContent = function isWithContent() {
86
75
  return this.getTitle() || this._getContent();
87
76
  };
88
77
 
89
- Popover.prototype.addAttachmentClass = function addAttachmentClass(attachment) {
90
- $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment);
78
+ _proto.addAttachmentClass = function addAttachmentClass(attachment) {
79
+ $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
91
80
  };
92
81
 
93
- Popover.prototype.getTipElement = function getTipElement() {
94
- return this.tip = this.tip || $(this.config.template)[0];
82
+ _proto.getTipElement = function getTipElement() {
83
+ this.tip = this.tip || $(this.config.template)[0];
84
+ return this.tip;
95
85
  };
96
86
 
97
- Popover.prototype.setContent = function setContent() {
98
- var $tip = $(this.getTipElement());
87
+ _proto.setContent = function setContent() {
88
+ var $tip = $(this.getTipElement()); // we use append for html objects to maintain js events
99
89
 
100
- // we use append for html objects to maintain js events
101
90
  this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
102
91
  this.setElementContent($tip.find(Selector.CONTENT), this._getContent());
92
+ $tip.removeClass(ClassName.FADE + " " + ClassName.SHOW);
93
+ }; // private
103
94
 
104
- $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
105
- };
106
-
107
- // private
108
95
 
109
- Popover.prototype._getContent = function _getContent() {
96
+ _proto._getContent = function _getContent() {
110
97
  return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content);
111
98
  };
112
99
 
113
- Popover.prototype._cleanTipClass = function _cleanTipClass() {
100
+ _proto._cleanTipClass = function _cleanTipClass() {
114
101
  var $tip = $(this.getTipElement());
115
102
  var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
103
+
116
104
  if (tabClass !== null && tabClass.length > 0) {
117
105
  $tip.removeClass(tabClass.join(''));
118
106
  }
119
- };
107
+ }; // static
120
108
 
121
- // static
122
109
 
123
110
  Popover._jQueryInterface = function _jQueryInterface(config) {
124
111
  return this.each(function () {
125
112
  var data = $(this).data(DATA_KEY);
126
- var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
113
+
114
+ var _config = typeof config === 'object' ? config : null;
127
115
 
128
116
  if (!data && /destroy|hide/.test(config)) {
129
117
  return;
@@ -135,50 +123,48 @@ var Popover = function ($) {
135
123
  }
136
124
 
137
125
  if (typeof config === 'string') {
138
- if (data[config] === undefined) {
139
- throw new Error('No method named "' + config + '"');
126
+ if (typeof data[config] === 'undefined') {
127
+ throw new Error("No method named \"" + config + "\"");
140
128
  }
129
+
141
130
  data[config]();
142
131
  }
143
132
  });
144
133
  };
145
134
 
146
135
  _createClass(Popover, null, [{
147
- key: 'VERSION',
148
-
149
-
136
+ key: "VERSION",
150
137
  // getters
151
-
152
138
  get: function get() {
153
139
  return VERSION;
154
140
  }
155
141
  }, {
156
- key: 'Default',
142
+ key: "Default",
157
143
  get: function get() {
158
144
  return Default;
159
145
  }
160
146
  }, {
161
- key: 'NAME',
147
+ key: "NAME",
162
148
  get: function get() {
163
149
  return NAME;
164
150
  }
165
151
  }, {
166
- key: 'DATA_KEY',
152
+ key: "DATA_KEY",
167
153
  get: function get() {
168
154
  return DATA_KEY;
169
155
  }
170
156
  }, {
171
- key: 'Event',
157
+ key: "Event",
172
158
  get: function get() {
173
159
  return Event;
174
160
  }
175
161
  }, {
176
- key: 'EVENT_KEY',
162
+ key: "EVENT_KEY",
177
163
  get: function get() {
178
164
  return EVENT_KEY;
179
165
  }
180
166
  }, {
181
- key: 'DefaultType',
167
+ key: "DefaultType",
182
168
  get: function get() {
183
169
  return DefaultType;
184
170
  }
@@ -186,19 +172,20 @@ var Popover = function ($) {
186
172
 
187
173
  return Popover;
188
174
  }(Tooltip);
189
-
190
175
  /**
191
176
  * ------------------------------------------------------------------------
192
177
  * jQuery
193
178
  * ------------------------------------------------------------------------
194
179
  */
195
180
 
181
+
196
182
  $.fn[NAME] = Popover._jQueryInterface;
197
183
  $.fn[NAME].Constructor = Popover;
184
+
198
185
  $.fn[NAME].noConflict = function () {
199
186
  $.fn[NAME] = JQUERY_NO_CONFLICT;
200
187
  return Popover._jQueryInterface;
201
188
  };
202
189
 
203
190
  return Popover;
204
- }(jQuery);
191
+ }($);
@@ -1,70 +1,59 @@
1
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
1
+ 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); } }
2
2
 
3
- var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
-
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
6
4
 
7
5
  /**
8
6
  * --------------------------------------------------------------------------
9
- * Bootstrap (v4.0.0-beta): scrollspy.js
7
+ * Bootstrap (v4.0.0-beta.2): scrollspy.js
10
8
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
11
9
  * --------------------------------------------------------------------------
12
10
  */
13
-
14
- var ScrollSpy = function ($) {
15
-
11
+ var ScrollSpy = function () {
16
12
  /**
17
13
  * ------------------------------------------------------------------------
18
14
  * Constants
19
15
  * ------------------------------------------------------------------------
20
16
  */
21
-
22
17
  var NAME = 'scrollspy';
23
- var VERSION = '4.0.0-beta';
18
+ var VERSION = '4.0.0-beta.2';
24
19
  var DATA_KEY = 'bs.scrollspy';
25
- var EVENT_KEY = '.' + DATA_KEY;
20
+ var EVENT_KEY = "." + DATA_KEY;
26
21
  var DATA_API_KEY = '.data-api';
27
22
  var JQUERY_NO_CONFLICT = $.fn[NAME];
28
-
29
23
  var Default = {
30
24
  offset: 10,
31
25
  method: 'auto',
32
26
  target: ''
33
27
  };
34
-
35
28
  var DefaultType = {
36
29
  offset: 'number',
37
30
  method: 'string',
38
31
  target: '(string|element)'
39
32
  };
40
-
41
33
  var Event = {
42
- ACTIVATE: 'activate' + EVENT_KEY,
43
- SCROLL: 'scroll' + EVENT_KEY,
44
- LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
34
+ ACTIVATE: "activate" + EVENT_KEY,
35
+ SCROLL: "scroll" + EVENT_KEY,
36
+ LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY
45
37
  };
46
-
47
38
  var ClassName = {
48
39
  DROPDOWN_ITEM: 'dropdown-item',
49
40
  DROPDOWN_MENU: 'dropdown-menu',
50
41
  ACTIVE: 'active'
51
42
  };
52
-
53
43
  var Selector = {
54
44
  DATA_SPY: '[data-spy="scroll"]',
55
45
  ACTIVE: '.active',
56
46
  NAV_LIST_GROUP: '.nav, .list-group',
57
47
  NAV_LINKS: '.nav-link',
48
+ NAV_ITEMS: '.nav-item',
58
49
  LIST_ITEMS: '.list-group-item',
59
50
  DROPDOWN: '.dropdown',
60
51
  DROPDOWN_ITEMS: '.dropdown-item',
61
52
  DROPDOWN_TOGGLE: '.dropdown-toggle'
62
53
  };
63
-
64
54
  var OffsetMethod = {
65
55
  OFFSET: 'offset',
66
56
  POSITION: 'position'
67
-
68
57
  /**
69
58
  * ------------------------------------------------------------------------
70
59
  * Class Definition
@@ -72,51 +61,45 @@ var ScrollSpy = function ($) {
72
61
  */
73
62
 
74
63
  };
75
- var ScrollSpy = function () {
64
+
65
+ var ScrollSpy =
66
+ /*#__PURE__*/
67
+ function () {
76
68
  function ScrollSpy(element, config) {
77
69
  var _this = this;
78
70
 
79
- _classCallCheck(this, ScrollSpy);
80
-
81
71
  this._element = element;
82
72
  this._scrollElement = element.tagName === 'BODY' ? window : element;
83
73
  this._config = this._getConfig(config);
84
- this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.LIST_ITEMS + ',') + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
74
+ this._selector = this._config.target + " " + Selector.NAV_LINKS + "," + (this._config.target + " " + Selector.LIST_ITEMS + ",") + (this._config.target + " " + Selector.DROPDOWN_ITEMS);
85
75
  this._offsets = [];
86
76
  this._targets = [];
87
77
  this._activeTarget = null;
88
78
  this._scrollHeight = 0;
89
-
90
79
  $(this._scrollElement).on(Event.SCROLL, function (event) {
91
80
  return _this._process(event);
92
81
  });
93
-
94
82
  this.refresh();
83
+
95
84
  this._process();
96
- }
85
+ } // getters
97
86
 
98
- // getters
99
87
 
100
- // public
88
+ var _proto = ScrollSpy.prototype;
101
89
 
102
- ScrollSpy.prototype.refresh = function refresh() {
90
+ // public
91
+ _proto.refresh = function refresh() {
103
92
  var _this2 = this;
104
93
 
105
94
  var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
106
-
107
95
  var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
108
-
109
96
  var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
110
-
111
97
  this._offsets = [];
112
98
  this._targets = [];
113
-
114
99
  this._scrollHeight = this._getScrollHeight();
115
-
116
100
  var targets = $.makeArray($(this._selector));
117
-
118
101
  targets.map(function (element) {
119
- var target = void 0;
102
+ var target;
120
103
  var targetSelector = Util.getSelectorFromElement(element);
121
104
 
122
105
  if (targetSelector) {
@@ -125,11 +108,13 @@ var ScrollSpy = function ($) {
125
108
 
126
109
  if (target) {
127
110
  var targetBCR = target.getBoundingClientRect();
111
+
128
112
  if (targetBCR.width || targetBCR.height) {
129
113
  // todo (fat): remove sketch reliance on jQuery position/offset
130
114
  return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
131
115
  }
132
116
  }
117
+
133
118
  return null;
134
119
  }).filter(function (item) {
135
120
  return item;
@@ -137,14 +122,14 @@ var ScrollSpy = function ($) {
137
122
  return a[0] - b[0];
138
123
  }).forEach(function (item) {
139
124
  _this2._offsets.push(item[0]);
125
+
140
126
  _this2._targets.push(item[1]);
141
127
  });
142
128
  };
143
129
 
144
- ScrollSpy.prototype.dispose = function dispose() {
130
+ _proto.dispose = function dispose() {
145
131
  $.removeData(this._element, DATA_KEY);
146
132
  $(this._scrollElement).off(EVENT_KEY);
147
-
148
133
  this._element = null;
149
134
  this._scrollElement = null;
150
135
  this._config = null;
@@ -153,42 +138,44 @@ var ScrollSpy = function ($) {
153
138
  this._targets = null;
154
139
  this._activeTarget = null;
155
140
  this._scrollHeight = null;
156
- };
141
+ }; // private
157
142
 
158
- // private
159
143
 
160
- ScrollSpy.prototype._getConfig = function _getConfig(config) {
144
+ _proto._getConfig = function _getConfig(config) {
161
145
  config = $.extend({}, Default, config);
162
146
 
163
147
  if (typeof config.target !== 'string') {
164
148
  var id = $(config.target).attr('id');
149
+
165
150
  if (!id) {
166
151
  id = Util.getUID(NAME);
167
152
  $(config.target).attr('id', id);
168
153
  }
169
- config.target = '#' + id;
154
+
155
+ config.target = "#" + id;
170
156
  }
171
157
 
172
158
  Util.typeCheckConfig(NAME, config, DefaultType);
173
-
174
159
  return config;
175
160
  };
176
161
 
177
- ScrollSpy.prototype._getScrollTop = function _getScrollTop() {
162
+ _proto._getScrollTop = function _getScrollTop() {
178
163
  return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
179
164
  };
180
165
 
181
- ScrollSpy.prototype._getScrollHeight = function _getScrollHeight() {
166
+ _proto._getScrollHeight = function _getScrollHeight() {
182
167
  return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
183
168
  };
184
169
 
185
- ScrollSpy.prototype._getOffsetHeight = function _getOffsetHeight() {
170
+ _proto._getOffsetHeight = function _getOffsetHeight() {
186
171
  return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
187
172
  };
188
173
 
189
- ScrollSpy.prototype._process = function _process() {
174
+ _proto._process = function _process() {
190
175
  var scrollTop = this._getScrollTop() + this._config.offset;
176
+
191
177
  var scrollHeight = this._getScrollHeight();
178
+
192
179
  var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
193
180
 
194
181
  if (this._scrollHeight !== scrollHeight) {
@@ -201,17 +188,20 @@ var ScrollSpy = function ($) {
201
188
  if (this._activeTarget !== target) {
202
189
  this._activate(target);
203
190
  }
191
+
204
192
  return;
205
193
  }
206
194
 
207
195
  if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
208
196
  this._activeTarget = null;
197
+
209
198
  this._clear();
199
+
210
200
  return;
211
201
  }
212
202
 
213
203
  for (var i = this._offsets.length; i--;) {
214
- var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]);
204
+ var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
215
205
 
216
206
  if (isActiveTarget) {
217
207
  this._activate(this._targets[i]);
@@ -219,16 +209,17 @@ var ScrollSpy = function ($) {
219
209
  }
220
210
  };
221
211
 
222
- ScrollSpy.prototype._activate = function _activate(target) {
212
+ _proto._activate = function _activate(target) {
223
213
  this._activeTarget = target;
224
214
 
225
215
  this._clear();
226
216
 
227
- var queries = this._selector.split(',');
217
+ var queries = this._selector.split(','); // eslint-disable-next-line arrow-body-style
218
+
219
+
228
220
  queries = queries.map(function (selector) {
229
- return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
221
+ return selector + "[data-target=\"" + target + "\"]," + (selector + "[href=\"" + target + "\"]");
230
222
  });
231
-
232
223
  var $link = $(queries.join(','));
233
224
 
234
225
  if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
@@ -236,10 +227,12 @@ var ScrollSpy = function ($) {
236
227
  $link.addClass(ClassName.ACTIVE);
237
228
  } else {
238
229
  // Set triggered link as active
239
- $link.addClass(ClassName.ACTIVE);
240
- // Set triggered links parents as active
230
+ $link.addClass(ClassName.ACTIVE); // Set triggered links parents as active
241
231
  // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
242
- $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ', ' + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE);
232
+
233
+ $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ", " + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE); // Handle special case when .nav-link is inside .nav-item
234
+
235
+ $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).children(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
243
236
  }
244
237
 
245
238
  $(this._scrollElement).trigger(Event.ACTIVATE, {
@@ -247,16 +240,16 @@ var ScrollSpy = function ($) {
247
240
  });
248
241
  };
249
242
 
250
- ScrollSpy.prototype._clear = function _clear() {
243
+ _proto._clear = function _clear() {
251
244
  $(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
252
- };
245
+ }; // static
253
246
 
254
- // static
255
247
 
256
248
  ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
257
249
  return this.each(function () {
258
250
  var data = $(this).data(DATA_KEY);
259
- var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config;
251
+
252
+ var _config = typeof config === 'object' && config;
260
253
 
261
254
  if (!data) {
262
255
  data = new ScrollSpy(this, _config);
@@ -264,21 +257,22 @@ var ScrollSpy = function ($) {
264
257
  }
265
258
 
266
259
  if (typeof config === 'string') {
267
- if (data[config] === undefined) {
268
- throw new Error('No method named "' + config + '"');
260
+ if (typeof data[config] === 'undefined') {
261
+ throw new Error("No method named \"" + config + "\"");
269
262
  }
263
+
270
264
  data[config]();
271
265
  }
272
266
  });
273
267
  };
274
268
 
275
269
  _createClass(ScrollSpy, null, [{
276
- key: 'VERSION',
270
+ key: "VERSION",
277
271
  get: function get() {
278
272
  return VERSION;
279
273
  }
280
274
  }, {
281
- key: 'Default',
275
+ key: "Default",
282
276
  get: function get() {
283
277
  return Default;
284
278
  }
@@ -286,22 +280,22 @@ var ScrollSpy = function ($) {
286
280
 
287
281
  return ScrollSpy;
288
282
  }();
289
-
290
283
  /**
291
284
  * ------------------------------------------------------------------------
292
285
  * Data Api implementation
293
286
  * ------------------------------------------------------------------------
294
287
  */
295
288
 
289
+
296
290
  $(window).on(Event.LOAD_DATA_API, function () {
297
291
  var scrollSpys = $.makeArray($(Selector.DATA_SPY));
298
292
 
299
293
  for (var i = scrollSpys.length; i--;) {
300
294
  var $spy = $(scrollSpys[i]);
295
+
301
296
  ScrollSpy._jQueryInterface.call($spy, $spy.data());
302
297
  }
303
298
  });
304
-
305
299
  /**
306
300
  * ------------------------------------------------------------------------
307
301
  * jQuery
@@ -310,10 +304,11 @@ var ScrollSpy = function ($) {
310
304
 
311
305
  $.fn[NAME] = ScrollSpy._jQueryInterface;
312
306
  $.fn[NAME].Constructor = ScrollSpy;
307
+
313
308
  $.fn[NAME].noConflict = function () {
314
309
  $.fn[NAME] = JQUERY_NO_CONFLICT;
315
310
  return ScrollSpy._jQueryInterface;
316
311
  };
317
312
 
318
313
  return ScrollSpy;
319
- }(jQuery);
314
+ }($);