bootstrap 5.0.0.beta2 → 5.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/assets/javascripts/bootstrap-sprockets.js +1 -0
  4. data/assets/javascripts/bootstrap.js +2051 -2009
  5. data/assets/javascripts/bootstrap.min.js +2 -2
  6. data/assets/javascripts/bootstrap/alert.js +75 -118
  7. data/assets/javascripts/bootstrap/base-component.js +23 -37
  8. data/assets/javascripts/bootstrap/button.js +39 -78
  9. data/assets/javascripts/bootstrap/carousel.js +284 -364
  10. data/assets/javascripts/bootstrap/collapse.js +178 -247
  11. data/assets/javascripts/bootstrap/dom/data.js +34 -47
  12. data/assets/javascripts/bootstrap/dom/event-handler.js +71 -77
  13. data/assets/javascripts/bootstrap/dom/manipulator.js +23 -21
  14. data/assets/javascripts/bootstrap/dom/selector-engine.js +20 -28
  15. data/assets/javascripts/bootstrap/dropdown.js +195 -265
  16. data/assets/javascripts/bootstrap/modal.js +256 -344
  17. data/assets/javascripts/bootstrap/offcanvas.js +508 -0
  18. data/assets/javascripts/bootstrap/popover.js +88 -157
  19. data/assets/javascripts/bootstrap/scrollspy.js +134 -212
  20. data/assets/javascripts/bootstrap/tab.js +108 -142
  21. data/assets/javascripts/bootstrap/toast.js +113 -183
  22. data/assets/javascripts/bootstrap/tooltip.js +297 -392
  23. data/assets/stylesheets/_bootstrap-grid.scss +1 -1
  24. data/assets/stylesheets/_bootstrap-reboot.scss +1 -1
  25. data/assets/stylesheets/_bootstrap.scss +2 -1
  26. data/assets/stylesheets/bootstrap/_accordion.scss +22 -32
  27. data/assets/stylesheets/bootstrap/_buttons.scss +2 -0
  28. data/assets/stylesheets/bootstrap/_card.scss +1 -1
  29. data/assets/stylesheets/bootstrap/_dropdown.scss +3 -6
  30. data/assets/stylesheets/bootstrap/_list-group.scss +11 -0
  31. data/assets/stylesheets/bootstrap/_modal.scss +2 -0
  32. data/assets/stylesheets/bootstrap/_nav.scss +7 -0
  33. data/assets/stylesheets/bootstrap/_navbar.scss +2 -0
  34. data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
  35. data/assets/stylesheets/bootstrap/_progress.scss +3 -0
  36. data/assets/stylesheets/bootstrap/_reboot.scss +7 -21
  37. data/assets/stylesheets/bootstrap/_spinners.scss +4 -0
  38. data/assets/stylesheets/bootstrap/_transitions.scss +2 -0
  39. data/assets/stylesheets/bootstrap/_utilities.scss +65 -37
  40. data/assets/stylesheets/bootstrap/_variables.scss +138 -30
  41. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
  42. data/assets/stylesheets/bootstrap/forms/_form-control.scss +0 -4
  43. data/assets/stylesheets/bootstrap/mixins/_alert.scss +2 -0
  44. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +2 -0
  45. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +6 -1
  46. data/assets/stylesheets/bootstrap/mixins/_caret.scss +2 -0
  47. data/assets/stylesheets/bootstrap/mixins/_forms.scss +11 -1
  48. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  49. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +2 -0
  50. data/bootstrap.gemspec +1 -1
  51. data/lib/bootstrap/version.rb +2 -2
  52. data/tasks/updater/js.rb +1 -1
  53. data/tasks/updater/network.rb +7 -1
  54. metadata +6 -4
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap data.js v5.0.0-beta2 (https://getbootstrap.com/)
2
+ * Bootstrap data.js v5.0.0-beta3 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0-beta2): dom/data.js
14
+ * Bootstrap (v5.0.0-beta3): dom/data.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
@@ -21,61 +21,48 @@
21
21
  * Constants
22
22
  * ------------------------------------------------------------------------
23
23
  */
24
- var mapData = function () {
25
- var storeData = {};
26
- var id = 1;
27
- return {
28
- set: function set(element, key, data) {
29
- if (typeof element.bsKey === 'undefined') {
30
- element.bsKey = {
31
- key: key,
32
- id: id
33
- };
34
- id++;
35
- }
24
+ const elementMap = new Map();
25
+ var data = {
26
+ set(element, key, instance) {
27
+ if (!elementMap.has(element)) {
28
+ elementMap.set(element, new Map());
29
+ }
36
30
 
37
- storeData[element.bsKey.id] = data;
38
- },
39
- get: function get(element, key) {
40
- if (!element || typeof element.bsKey === 'undefined') {
41
- return null;
42
- }
31
+ const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
32
+ // can be removed later when multiple key/instances are fine to be used
43
33
 
44
- var keyProperties = element.bsKey;
34
+ if (!instanceMap.has(key) && instanceMap.size !== 0) {
35
+ // eslint-disable-next-line no-console
36
+ console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
37
+ return;
38
+ }
45
39
 
46
- if (keyProperties.key === key) {
47
- return storeData[keyProperties.id];
48
- }
40
+ instanceMap.set(key, instance);
41
+ },
49
42
 
50
- return null;
51
- },
52
- delete: function _delete(element, key) {
53
- if (typeof element.bsKey === 'undefined') {
54
- return;
55
- }
43
+ get(element, key) {
44
+ if (elementMap.has(element)) {
45
+ return elementMap.get(element).get(key) || null;
46
+ }
56
47
 
57
- var keyProperties = element.bsKey;
48
+ return null;
49
+ },
58
50
 
59
- if (keyProperties.key === key) {
60
- delete storeData[keyProperties.id];
61
- delete element.bsKey;
62
- }
51
+ remove(element, key) {
52
+ if (!elementMap.has(element)) {
53
+ return;
63
54
  }
64
- };
65
- }();
66
55
 
67
- var Data = {
68
- setData: function setData(instance, key, data) {
69
- mapData.set(instance, key, data);
70
- },
71
- getData: function getData(instance, key) {
72
- return mapData.get(instance, key);
73
- },
74
- removeData: function removeData(instance, key) {
75
- mapData.delete(instance, key);
56
+ const instanceMap = elementMap.get(element);
57
+ instanceMap.delete(key); // free up element references if there are no instances left for an element
58
+
59
+ if (instanceMap.size === 0) {
60
+ elementMap.delete(element);
61
+ }
76
62
  }
63
+
77
64
  };
78
65
 
79
- return Data;
66
+ return data;
80
67
 
81
68
  })));
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap event-handler.js v5.0.0-beta2 (https://getbootstrap.com/)
2
+ * Bootstrap event-handler.js v5.0.0-beta3 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
@@ -11,14 +11,15 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0-beta2): util/index.js
14
+ * Bootstrap (v5.0.0-beta3): util/index.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
18
18
 
19
- var getjQuery = function getjQuery() {
20
- var _window = window,
21
- jQuery = _window.jQuery;
19
+ const getjQuery = () => {
20
+ const {
21
+ jQuery
22
+ } = window;
22
23
 
23
24
  if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
24
25
  return jQuery;
@@ -27,11 +28,9 @@
27
28
  return null;
28
29
  };
29
30
 
30
- document.documentElement.dir === 'rtl';
31
-
32
31
  /**
33
32
  * --------------------------------------------------------------------------
34
- * Bootstrap (v5.0.0-beta2): dom/event-handler.js
33
+ * Bootstrap (v5.0.0-beta3): dom/event-handler.js
35
34
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
36
35
  * --------------------------------------------------------------------------
37
36
  */
@@ -41,17 +40,17 @@
41
40
  * ------------------------------------------------------------------------
42
41
  */
43
42
 
44
- var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
45
- var stripNameRegex = /\..*/;
46
- var stripUidRegex = /::\d+$/;
47
- var eventRegistry = {}; // Events storage
43
+ const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
44
+ const stripNameRegex = /\..*/;
45
+ const stripUidRegex = /::\d+$/;
46
+ const eventRegistry = {}; // Events storage
48
47
 
49
- var uidEvent = 1;
50
- var customEvents = {
48
+ let uidEvent = 1;
49
+ const customEvents = {
51
50
  mouseenter: 'mouseover',
52
51
  mouseleave: 'mouseout'
53
52
  };
54
- var nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
53
+ const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
55
54
  /**
56
55
  * ------------------------------------------------------------------------
57
56
  * Private methods
@@ -59,11 +58,11 @@
59
58
  */
60
59
 
61
60
  function getUidEvent(element, uid) {
62
- return uid && uid + "::" + uidEvent++ || element.uidEvent || uidEvent++;
61
+ return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
63
62
  }
64
63
 
65
64
  function getEvent(element) {
66
- var uid = getUidEvent(element);
65
+ const uid = getUidEvent(element);
67
66
  element.uidEvent = uid;
68
67
  eventRegistry[uid] = eventRegistry[uid] || {};
69
68
  return eventRegistry[uid];
@@ -83,10 +82,12 @@
83
82
 
84
83
  function bootstrapDelegationHandler(element, selector, fn) {
85
84
  return function handler(event) {
86
- var domElements = element.querySelectorAll(selector);
85
+ const domElements = element.querySelectorAll(selector);
87
86
 
88
- for (var target = event.target; target && target !== this; target = target.parentNode) {
89
- for (var i = domElements.length; i--;) {
87
+ for (let {
88
+ target
89
+ } = event; target && target !== this; target = target.parentNode) {
90
+ for (let i = domElements.length; i--;) {
90
91
  if (domElements[i] === target) {
91
92
  event.delegateTarget = target;
92
93
 
@@ -105,15 +106,11 @@
105
106
  };
106
107
  }
107
108
 
108
- function findHandler(events, handler, delegationSelector) {
109
- if (delegationSelector === void 0) {
110
- delegationSelector = null;
111
- }
112
-
113
- var uidEventList = Object.keys(events);
109
+ function findHandler(events, handler, delegationSelector = null) {
110
+ const uidEventList = Object.keys(events);
114
111
 
115
- for (var i = 0, len = uidEventList.length; i < len; i++) {
116
- var event = events[uidEventList[i]];
112
+ for (let i = 0, len = uidEventList.length; i < len; i++) {
113
+ const event = events[uidEventList[i]];
117
114
 
118
115
  if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
119
116
  return event;
@@ -124,17 +121,17 @@
124
121
  }
125
122
 
126
123
  function normalizeParams(originalTypeEvent, handler, delegationFn) {
127
- var delegation = typeof handler === 'string';
128
- var originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
124
+ const delegation = typeof handler === 'string';
125
+ const originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
129
126
 
130
- var typeEvent = originalTypeEvent.replace(stripNameRegex, '');
131
- var custom = customEvents[typeEvent];
127
+ let typeEvent = originalTypeEvent.replace(stripNameRegex, '');
128
+ const custom = customEvents[typeEvent];
132
129
 
133
130
  if (custom) {
134
131
  typeEvent = custom;
135
132
  }
136
133
 
137
- var isNative = nativeEvents.has(typeEvent);
134
+ const isNative = nativeEvents.has(typeEvent);
138
135
 
139
136
  if (!isNative) {
140
137
  typeEvent = originalTypeEvent;
@@ -153,22 +150,18 @@
153
150
  delegationFn = null;
154
151
  }
155
152
 
156
- var _normalizeParams = normalizeParams(originalTypeEvent, handler, delegationFn),
157
- delegation = _normalizeParams[0],
158
- originalHandler = _normalizeParams[1],
159
- typeEvent = _normalizeParams[2];
160
-
161
- var events = getEvent(element);
162
- var handlers = events[typeEvent] || (events[typeEvent] = {});
163
- var previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
153
+ const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
154
+ const events = getEvent(element);
155
+ const handlers = events[typeEvent] || (events[typeEvent] = {});
156
+ const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
164
157
 
165
158
  if (previousFn) {
166
159
  previousFn.oneOff = previousFn.oneOff && oneOff;
167
160
  return;
168
161
  }
169
162
 
170
- var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
171
- var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
163
+ const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
164
+ const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
172
165
  fn.delegationSelector = delegation ? handler : null;
173
166
  fn.originalHandler = originalHandler;
174
167
  fn.oneOff = oneOff;
@@ -178,7 +171,7 @@
178
171
  }
179
172
 
180
173
  function removeHandler(element, events, typeEvent, handler, delegationSelector) {
181
- var fn = findHandler(events[typeEvent], handler, delegationSelector);
174
+ const fn = findHandler(events[typeEvent], handler, delegationSelector);
182
175
 
183
176
  if (!fn) {
184
177
  return;
@@ -189,35 +182,33 @@
189
182
  }
190
183
 
191
184
  function removeNamespacedHandlers(element, events, typeEvent, namespace) {
192
- var storeElementEvent = events[typeEvent] || {};
193
- Object.keys(storeElementEvent).forEach(function (handlerKey) {
185
+ const storeElementEvent = events[typeEvent] || {};
186
+ Object.keys(storeElementEvent).forEach(handlerKey => {
194
187
  if (handlerKey.includes(namespace)) {
195
- var event = storeElementEvent[handlerKey];
188
+ const event = storeElementEvent[handlerKey];
196
189
  removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
197
190
  }
198
191
  });
199
192
  }
200
193
 
201
- var EventHandler = {
202
- on: function on(element, event, handler, delegationFn) {
194
+ const EventHandler = {
195
+ on(element, event, handler, delegationFn) {
203
196
  addHandler(element, event, handler, delegationFn, false);
204
197
  },
205
- one: function one(element, event, handler, delegationFn) {
198
+
199
+ one(element, event, handler, delegationFn) {
206
200
  addHandler(element, event, handler, delegationFn, true);
207
201
  },
208
- off: function off(element, originalTypeEvent, handler, delegationFn) {
202
+
203
+ off(element, originalTypeEvent, handler, delegationFn) {
209
204
  if (typeof originalTypeEvent !== 'string' || !element) {
210
205
  return;
211
206
  }
212
207
 
213
- var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
214
- delegation = _normalizeParams2[0],
215
- originalHandler = _normalizeParams2[1],
216
- typeEvent = _normalizeParams2[2];
217
-
218
- var inNamespace = typeEvent !== originalTypeEvent;
219
- var events = getEvent(element);
220
- var isNamespace = originalTypeEvent.startsWith('.');
208
+ const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
209
+ const inNamespace = typeEvent !== originalTypeEvent;
210
+ const events = getEvent(element);
211
+ const isNamespace = originalTypeEvent.startsWith('.');
221
212
 
222
213
  if (typeof originalHandler !== 'undefined') {
223
214
  // Simplest case: handler is passed, remove that listener ONLY.
@@ -230,35 +221,36 @@
230
221
  }
231
222
 
232
223
  if (isNamespace) {
233
- Object.keys(events).forEach(function (elementEvent) {
224
+ Object.keys(events).forEach(elementEvent => {
234
225
  removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
235
226
  });
236
227
  }
237
228
 
238
- var storeElementEvent = events[typeEvent] || {};
239
- Object.keys(storeElementEvent).forEach(function (keyHandlers) {
240
- var handlerKey = keyHandlers.replace(stripUidRegex, '');
229
+ const storeElementEvent = events[typeEvent] || {};
230
+ Object.keys(storeElementEvent).forEach(keyHandlers => {
231
+ const handlerKey = keyHandlers.replace(stripUidRegex, '');
241
232
 
242
233
  if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
243
- var event = storeElementEvent[keyHandlers];
234
+ const event = storeElementEvent[keyHandlers];
244
235
  removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
245
236
  }
246
237
  });
247
238
  },
248
- trigger: function trigger(element, event, args) {
239
+
240
+ trigger(element, event, args) {
249
241
  if (typeof event !== 'string' || !element) {
250
242
  return null;
251
243
  }
252
244
 
253
- var $ = getjQuery();
254
- var typeEvent = event.replace(stripNameRegex, '');
255
- var inNamespace = event !== typeEvent;
256
- var isNative = nativeEvents.has(typeEvent);
257
- var jQueryEvent;
258
- var bubbles = true;
259
- var nativeDispatch = true;
260
- var defaultPrevented = false;
261
- var evt = null;
245
+ const $ = getjQuery();
246
+ const typeEvent = event.replace(stripNameRegex, '');
247
+ const inNamespace = event !== typeEvent;
248
+ const isNative = nativeEvents.has(typeEvent);
249
+ let jQueryEvent;
250
+ let bubbles = true;
251
+ let nativeDispatch = true;
252
+ let defaultPrevented = false;
253
+ let evt = null;
262
254
 
263
255
  if (inNamespace && $) {
264
256
  jQueryEvent = $.Event(event, args);
@@ -273,18 +265,19 @@
273
265
  evt.initEvent(typeEvent, bubbles, true);
274
266
  } else {
275
267
  evt = new CustomEvent(event, {
276
- bubbles: bubbles,
268
+ bubbles,
277
269
  cancelable: true
278
270
  });
279
271
  } // merge custom information in our event
280
272
 
281
273
 
282
274
  if (typeof args !== 'undefined') {
283
- Object.keys(args).forEach(function (key) {
275
+ Object.keys(args).forEach(key => {
284
276
  Object.defineProperty(evt, key, {
285
- get: function get() {
277
+ get() {
286
278
  return args[key];
287
279
  }
280
+
288
281
  });
289
282
  });
290
283
  }
@@ -303,6 +296,7 @@
303
296
 
304
297
  return evt;
305
298
  }
299
+
306
300
  };
307
301
 
308
302
  return EventHandler;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap manipulator.js v5.0.0-beta2 (https://getbootstrap.com/)
2
+ * Bootstrap manipulator.js v5.0.0-beta3 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0-beta2): dom/manipulator.js
14
+ * Bootstrap (v5.0.0-beta3): dom/manipulator.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
@@ -36,49 +36,51 @@
36
36
  }
37
37
 
38
38
  function normalizeDataKey(key) {
39
- return key.replace(/[A-Z]/g, function (chr) {
40
- return "-" + chr.toLowerCase();
41
- });
39
+ return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
42
40
  }
43
41
 
44
- var Manipulator = {
45
- setDataAttribute: function setDataAttribute(element, key, value) {
46
- element.setAttribute("data-bs-" + normalizeDataKey(key), value);
42
+ const Manipulator = {
43
+ setDataAttribute(element, key, value) {
44
+ element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
47
45
  },
48
- removeDataAttribute: function removeDataAttribute(element, key) {
49
- element.removeAttribute("data-bs-" + normalizeDataKey(key));
46
+
47
+ removeDataAttribute(element, key) {
48
+ element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
50
49
  },
51
- getDataAttributes: function getDataAttributes(element) {
50
+
51
+ getDataAttributes(element) {
52
52
  if (!element) {
53
53
  return {};
54
54
  }
55
55
 
56
- var attributes = {};
57
- Object.keys(element.dataset).filter(function (key) {
58
- return key.startsWith('bs');
59
- }).forEach(function (key) {
60
- var pureKey = key.replace(/^bs/, '');
56
+ const attributes = {};
57
+ Object.keys(element.dataset).filter(key => key.startsWith('bs')).forEach(key => {
58
+ let pureKey = key.replace(/^bs/, '');
61
59
  pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
62
60
  attributes[pureKey] = normalizeData(element.dataset[key]);
63
61
  });
64
62
  return attributes;
65
63
  },
66
- getDataAttribute: function getDataAttribute(element, key) {
67
- return normalizeData(element.getAttribute("data-bs-" + normalizeDataKey(key)));
64
+
65
+ getDataAttribute(element, key) {
66
+ return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
68
67
  },
69
- offset: function offset(element) {
70
- var rect = element.getBoundingClientRect();
68
+
69
+ offset(element) {
70
+ const rect = element.getBoundingClientRect();
71
71
  return {
72
72
  top: rect.top + document.body.scrollTop,
73
73
  left: rect.left + document.body.scrollLeft
74
74
  };
75
75
  },
76
- position: function position(element) {
76
+
77
+ position(element) {
77
78
  return {
78
79
  top: element.offsetTop,
79
80
  left: element.offsetLeft
80
81
  };
81
82
  }
83
+
82
84
  };
83
85
 
84
86
  return Manipulator;