bootstrap 4.0.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +8 -0
  4. data/README.md +2 -2
  5. data/Rakefile +4 -2
  6. data/assets/javascripts/bootstrap/alert.js +45 -22
  7. data/assets/javascripts/bootstrap/button.js +39 -19
  8. data/assets/javascripts/bootstrap/carousel.js +213 -51
  9. data/assets/javascripts/bootstrap/collapse.js +105 -52
  10. data/assets/javascripts/bootstrap/dropdown.js +169 -45
  11. data/assets/javascripts/bootstrap/modal.js +139 -71
  12. data/assets/javascripts/bootstrap/popover.js +77 -20
  13. data/assets/javascripts/bootstrap/scrollspy.js +87 -29
  14. data/assets/javascripts/bootstrap/tab.js +50 -32
  15. data/assets/javascripts/bootstrap/toast.js +282 -0
  16. data/assets/javascripts/bootstrap/tooltip.js +295 -59
  17. data/assets/javascripts/bootstrap/util.js +78 -45
  18. data/assets/javascripts/bootstrap-sprockets.js +7 -6
  19. data/assets/javascripts/bootstrap.js +1537 -996
  20. data/assets/javascripts/bootstrap.min.js +3 -3
  21. data/assets/stylesheets/_bootstrap-grid.scss +4 -7
  22. data/assets/stylesheets/_bootstrap-reboot.scss +3 -3
  23. data/assets/stylesheets/_bootstrap.scss +5 -3
  24. data/assets/stylesheets/bootstrap/_alert.scss +1 -1
  25. data/assets/stylesheets/bootstrap/_badge.scss +8 -1
  26. data/assets/stylesheets/bootstrap/_breadcrumb.scss +9 -6
  27. data/assets/stylesheets/bootstrap/_button-group.scss +16 -19
  28. data/assets/stylesheets/bootstrap/_buttons.scss +10 -16
  29. data/assets/stylesheets/bootstrap/_card.scss +53 -34
  30. data/assets/stylesheets/bootstrap/_carousel.scss +66 -60
  31. data/assets/stylesheets/bootstrap/_close.scss +15 -8
  32. data/assets/stylesheets/bootstrap/_code.scss +5 -13
  33. data/assets/stylesheets/bootstrap/_custom-forms.scss +250 -40
  34. data/assets/stylesheets/bootstrap/_dropdown.scss +65 -5
  35. data/assets/stylesheets/bootstrap/_forms.scss +32 -35
  36. data/assets/stylesheets/bootstrap/_functions.scss +9 -9
  37. data/assets/stylesheets/bootstrap/_images.scss +2 -2
  38. data/assets/stylesheets/bootstrap/_input-group.scss +45 -11
  39. data/assets/stylesheets/bootstrap/_jumbotron.scss +1 -0
  40. data/assets/stylesheets/bootstrap/_list-group.scss +39 -5
  41. data/assets/stylesheets/bootstrap/_mixins.scss +6 -1
  42. data/assets/stylesheets/bootstrap/_modal.scss +80 -19
  43. data/assets/stylesheets/bootstrap/_nav.scss +2 -0
  44. data/assets/stylesheets/bootstrap/_navbar.scss +9 -26
  45. data/assets/stylesheets/bootstrap/_pagination.scss +2 -6
  46. data/assets/stylesheets/bootstrap/_popover.scss +47 -59
  47. data/assets/stylesheets/bootstrap/_print.scss +23 -6
  48. data/assets/stylesheets/bootstrap/_progress.scss +16 -6
  49. data/assets/stylesheets/bootstrap/_reboot.scss +51 -50
  50. data/assets/stylesheets/bootstrap/_spinners.scss +55 -0
  51. data/assets/stylesheets/bootstrap/_tables.scss +16 -11
  52. data/assets/stylesheets/bootstrap/_toasts.scss +44 -0
  53. data/assets/stylesheets/bootstrap/_tooltip.scss +1 -1
  54. data/assets/stylesheets/bootstrap/_transitions.scss +4 -20
  55. data/assets/stylesheets/bootstrap/_type.scss +16 -16
  56. data/assets/stylesheets/bootstrap/_utilities.scss +3 -0
  57. data/assets/stylesheets/bootstrap/_variables.scss +430 -201
  58. data/assets/stylesheets/bootstrap/mixins/_badge.scss +7 -2
  59. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +29 -1
  60. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +16 -1
  61. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +3 -3
  62. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +12 -14
  63. data/assets/stylesheets/bootstrap/mixins/_caret.scss +5 -8
  64. data/assets/stylesheets/bootstrap/mixins/_deprecate.scss +10 -0
  65. data/assets/stylesheets/bootstrap/mixins/_float.scss +3 -0
  66. data/assets/stylesheets/bootstrap/mixins/_forms.scss +68 -13
  67. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +7 -7
  68. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +3 -4
  69. data/assets/stylesheets/bootstrap/mixins/_grid.scss +9 -10
  70. data/assets/stylesheets/bootstrap/mixins/_hover.scss +3 -5
  71. data/assets/stylesheets/bootstrap/mixins/_image.scss +2 -2
  72. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +1 -1
  73. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +2 -2
  74. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +1 -1
  75. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +1 -1
  76. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +1 -3
  77. data/assets/stylesheets/bootstrap/mixins/_size.scss +1 -0
  78. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +10 -1
  79. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +5 -3
  80. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +3 -1
  81. data/assets/stylesheets/bootstrap/mixins/_transition.scss +7 -0
  82. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +1 -0
  83. data/assets/stylesheets/bootstrap/utilities/_borders.scss +17 -1
  84. data/assets/stylesheets/bootstrap/utilities/_display.scss +6 -18
  85. data/assets/stylesheets/bootstrap/utilities/_embed.scss +7 -20
  86. data/assets/stylesheets/bootstrap/utilities/_flex.scss +5 -0
  87. data/assets/stylesheets/bootstrap/utilities/_float.scss +5 -3
  88. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +5 -0
  89. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -4
  90. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +6 -0
  91. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +8 -0
  92. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +23 -1
  93. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +19 -0
  94. data/assets/stylesheets/bootstrap/utilities/_text.scss +26 -6
  95. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +4 -2
  96. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +204 -0
  97. data/bootstrap.gemspec +6 -3
  98. data/lib/bootstrap/engine.rb +3 -0
  99. data/lib/bootstrap/version.rb +4 -2
  100. data/lib/bootstrap.rb +10 -7
  101. data/tasks/updater/js.rb +1 -1
  102. data/test/test_helper.rb +7 -6
  103. metadata +19 -12
  104. data/assets/stylesheets/bootstrap/mixins/_navbar-align.scss +0 -10
@@ -1,29 +1,203 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ /*!
2
+ * Bootstrap tooltip.js v4.3.1 (https://getbootstrap.com/)
3
+ * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5
+ */
6
+ (function (global, factory) {
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('popper.js'), require('./util.js')) :
8
+ typeof define === 'function' && define.amd ? define(['jquery', 'popper.js', './util.js'], factory) :
9
+ (global = global || self, global.Tooltip = factory(global.jQuery, global.Popper, global.Util));
10
+ }(this, function ($, Popper, Util) { 'use strict';
11
+
12
+ $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
13
+ Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
14
+ Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
15
+
16
+ function _defineProperties(target, props) {
17
+ for (var i = 0; i < props.length; i++) {
18
+ var descriptor = props[i];
19
+ descriptor.enumerable = descriptor.enumerable || false;
20
+ descriptor.configurable = true;
21
+ if ("value" in descriptor) descriptor.writable = true;
22
+ Object.defineProperty(target, descriptor.key, descriptor);
23
+ }
24
+ }
25
+
26
+ function _createClass(Constructor, protoProps, staticProps) {
27
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
28
+ if (staticProps) _defineProperties(Constructor, staticProps);
29
+ return Constructor;
30
+ }
31
+
32
+ function _defineProperty(obj, key, value) {
33
+ if (key in obj) {
34
+ Object.defineProperty(obj, key, {
35
+ value: value,
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true
39
+ });
40
+ } else {
41
+ obj[key] = value;
42
+ }
43
+
44
+ return obj;
45
+ }
46
+
47
+ function _objectSpread(target) {
48
+ for (var i = 1; i < arguments.length; i++) {
49
+ var source = arguments[i] != null ? arguments[i] : {};
50
+ var ownKeys = Object.keys(source);
51
+
52
+ if (typeof Object.getOwnPropertySymbols === 'function') {
53
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
54
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
55
+ }));
56
+ }
2
57
 
3
- 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); } }
58
+ ownKeys.forEach(function (key) {
59
+ _defineProperty(target, key, source[key]);
60
+ });
61
+ }
62
+
63
+ return target;
64
+ }
4
65
 
5
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
66
+ /**
67
+ * --------------------------------------------------------------------------
68
+ * Bootstrap (v4.3.1): tools/sanitizer.js
69
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
70
+ * --------------------------------------------------------------------------
71
+ */
72
+ var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
73
+ var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
74
+ var DefaultWhitelist = {
75
+ // Global attributes allowed on any supplied element below.
76
+ '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
77
+ a: ['target', 'href', 'title', 'rel'],
78
+ area: [],
79
+ b: [],
80
+ br: [],
81
+ col: [],
82
+ code: [],
83
+ div: [],
84
+ em: [],
85
+ hr: [],
86
+ h1: [],
87
+ h2: [],
88
+ h3: [],
89
+ h4: [],
90
+ h5: [],
91
+ h6: [],
92
+ i: [],
93
+ img: ['src', 'alt', 'title', 'width', 'height'],
94
+ li: [],
95
+ ol: [],
96
+ p: [],
97
+ pre: [],
98
+ s: [],
99
+ small: [],
100
+ span: [],
101
+ sub: [],
102
+ sup: [],
103
+ strong: [],
104
+ u: [],
105
+ ul: []
106
+ /**
107
+ * A pattern that recognizes a commonly useful subset of URLs that are safe.
108
+ *
109
+ * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
110
+ */
111
+
112
+ };
113
+ var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
114
+ /**
115
+ * A pattern that matches safe data URLs. Only matches image, video and audio types.
116
+ *
117
+ * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
118
+ */
119
+
120
+ var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
121
+
122
+ function allowedAttribute(attr, allowedAttributeList) {
123
+ var attrName = attr.nodeName.toLowerCase();
124
+
125
+ if (allowedAttributeList.indexOf(attrName) !== -1) {
126
+ if (uriAttrs.indexOf(attrName) !== -1) {
127
+ return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
128
+ }
129
+
130
+ return true;
131
+ }
132
+
133
+ var regExp = allowedAttributeList.filter(function (attrRegex) {
134
+ return attrRegex instanceof RegExp;
135
+ }); // Check if a regular expression validates the attribute.
136
+
137
+ for (var i = 0, l = regExp.length; i < l; i++) {
138
+ if (attrName.match(regExp[i])) {
139
+ return true;
140
+ }
141
+ }
142
+
143
+ return false;
144
+ }
145
+
146
+ function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
147
+ if (unsafeHtml.length === 0) {
148
+ return unsafeHtml;
149
+ }
150
+
151
+ if (sanitizeFn && typeof sanitizeFn === 'function') {
152
+ return sanitizeFn(unsafeHtml);
153
+ }
154
+
155
+ var domParser = new window.DOMParser();
156
+ var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
157
+ var whitelistKeys = Object.keys(whiteList);
158
+ var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
159
+
160
+ var _loop = function _loop(i, len) {
161
+ var el = elements[i];
162
+ var elName = el.nodeName.toLowerCase();
163
+
164
+ if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
165
+ el.parentNode.removeChild(el);
166
+ return "continue";
167
+ }
168
+
169
+ var attributeList = [].slice.call(el.attributes);
170
+ var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
171
+ attributeList.forEach(function (attr) {
172
+ if (!allowedAttribute(attr, whitelistedAttributes)) {
173
+ el.removeAttribute(attr.nodeName);
174
+ }
175
+ });
176
+ };
177
+
178
+ for (var i = 0, len = elements.length; i < len; i++) {
179
+ var _ret = _loop(i, len);
180
+
181
+ if (_ret === "continue") continue;
182
+ }
183
+
184
+ return createdDocument.body.innerHTML;
185
+ }
6
186
 
7
- /**
8
- * --------------------------------------------------------------------------
9
- * Bootstrap (v4.0.0): tooltip.js
10
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
11
- * --------------------------------------------------------------------------
12
- */
13
- var Tooltip = function ($) {
14
187
  /**
15
188
  * ------------------------------------------------------------------------
16
189
  * Constants
17
190
  * ------------------------------------------------------------------------
18
191
  */
192
+
19
193
  var NAME = 'tooltip';
20
- var VERSION = '4.0.0';
194
+ var VERSION = '4.3.1';
21
195
  var DATA_KEY = 'bs.tooltip';
22
196
  var EVENT_KEY = "." + DATA_KEY;
23
197
  var JQUERY_NO_CONFLICT = $.fn[NAME];
24
- var TRANSITION_DURATION = 150;
25
198
  var CLASS_PREFIX = 'bs-tooltip';
26
199
  var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
200
+ var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
27
201
  var DefaultType = {
28
202
  animation: 'boolean',
29
203
  template: 'string',
@@ -33,10 +207,13 @@ var Tooltip = function ($) {
33
207
  html: 'boolean',
34
208
  selector: '(string|boolean)',
35
209
  placement: '(string|function)',
36
- offset: '(number|string)',
210
+ offset: '(number|string|function)',
37
211
  container: '(string|element|boolean)',
38
212
  fallbackPlacement: '(string|array)',
39
- boundary: '(string|element)'
213
+ boundary: '(string|element)',
214
+ sanitize: 'boolean',
215
+ sanitizeFn: '(null|function)',
216
+ whiteList: 'object'
40
217
  };
41
218
  var AttachmentMap = {
42
219
  AUTO: 'auto',
@@ -57,7 +234,10 @@ var Tooltip = function ($) {
57
234
  offset: 0,
58
235
  container: false,
59
236
  fallbackPlacement: 'flip',
60
- boundary: 'scrollParent'
237
+ boundary: 'scrollParent',
238
+ sanitize: true,
239
+ sanitizeFn: null,
240
+ whiteList: DefaultWhitelist
61
241
  };
62
242
  var HoverState = {
63
243
  SHOW: 'show',
@@ -106,7 +286,7 @@ var Tooltip = function ($) {
106
286
  * Popper - https://popper.js.org
107
287
  */
108
288
  if (typeof Popper === 'undefined') {
109
- throw new TypeError('Bootstrap tooltips require Popper.js (https://popper.js.org)');
289
+ throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
110
290
  } // private
111
291
 
112
292
 
@@ -207,7 +387,8 @@ var Tooltip = function ($) {
207
387
 
208
388
  if (this.isWithContent() && this._isEnabled) {
209
389
  $(this.element).trigger(showEvent);
210
- var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
390
+ var shadowRoot = Util.findShadowRoot(this.element);
391
+ var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
211
392
 
212
393
  if (showEvent.isDefaultPrevented() || !isInTheDom) {
213
394
  return;
@@ -228,7 +409,9 @@ var Tooltip = function ($) {
228
409
  var attachment = this._getAttachment(placement);
229
410
 
230
411
  this.addAttachmentClass(attachment);
231
- var container = this.config.container === false ? document.body : $(this.config.container);
412
+
413
+ var container = this._getContainer();
414
+
232
415
  $(tip).data(this.constructor.DATA_KEY, this);
233
416
 
234
417
  if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
@@ -239,9 +422,7 @@ var Tooltip = function ($) {
239
422
  this._popper = new Popper(this.element, tip, {
240
423
  placement: attachment,
241
424
  modifiers: {
242
- offset: {
243
- offset: this.config.offset
244
- },
425
+ offset: this._getOffset(),
245
426
  flip: {
246
427
  behavior: this.config.fallbackPlacement
247
428
  },
@@ -258,7 +439,7 @@ var Tooltip = function ($) {
258
439
  }
259
440
  },
260
441
  onUpdate: function onUpdate(data) {
261
- _this._handlePopperPlacementChange(data);
442
+ return _this._handlePopperPlacementChange(data);
262
443
  }
263
444
  });
264
445
  $(tip).addClass(ClassName.SHOW); // If this is a touch-enabled device we add extra
@@ -267,7 +448,7 @@ var Tooltip = function ($) {
267
448
  // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
268
449
 
269
450
  if ('ontouchstart' in document.documentElement) {
270
- $('body').children().on('mouseover', null, $.noop);
451
+ $(document.body).children().on('mouseover', null, $.noop);
271
452
  }
272
453
 
273
454
  var complete = function complete() {
@@ -284,8 +465,9 @@ var Tooltip = function ($) {
284
465
  }
285
466
  };
286
467
 
287
- if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
288
- $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
468
+ if ($(this.tip).hasClass(ClassName.FADE)) {
469
+ var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
470
+ $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
289
471
  } else {
290
472
  complete();
291
473
  }
@@ -328,15 +510,16 @@ var Tooltip = function ($) {
328
510
  // empty mouseover listeners we added for iOS support
329
511
 
330
512
  if ('ontouchstart' in document.documentElement) {
331
- $('body').children().off('mouseover', null, $.noop);
513
+ $(document.body).children().off('mouseover', null, $.noop);
332
514
  }
333
515
 
334
516
  this._activeTrigger[Trigger.CLICK] = false;
335
517
  this._activeTrigger[Trigger.FOCUS] = false;
336
518
  this._activeTrigger[Trigger.HOVER] = false;
337
519
 
338
- if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
339
- $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
520
+ if ($(this.tip).hasClass(ClassName.FADE)) {
521
+ var transitionDuration = Util.getTransitionDurationFromElement(tip);
522
+ $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
340
523
  } else {
341
524
  complete();
342
525
  }
@@ -348,8 +531,8 @@ var Tooltip = function ($) {
348
531
  if (this._popper !== null) {
349
532
  this._popper.scheduleUpdate();
350
533
  }
351
- }; // Protected
352
-
534
+ } // Protected
535
+ ;
353
536
 
354
537
  _proto.isWithContent = function isWithContent() {
355
538
  return Boolean(this.getTitle());
@@ -365,25 +548,33 @@ var Tooltip = function ($) {
365
548
  };
366
549
 
367
550
  _proto.setContent = function setContent() {
368
- var $tip = $(this.getTipElement());
369
- this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
370
- $tip.removeClass(ClassName.FADE + " " + ClassName.SHOW);
551
+ var tip = this.getTipElement();
552
+ this.setElementContent($(tip.querySelectorAll(Selector.TOOLTIP_INNER)), this.getTitle());
553
+ $(tip).removeClass(ClassName.FADE + " " + ClassName.SHOW);
371
554
  };
372
555
 
373
556
  _proto.setElementContent = function setElementContent($element, content) {
374
- var html = this.config.html;
375
-
376
557
  if (typeof content === 'object' && (content.nodeType || content.jquery)) {
377
558
  // Content is a DOM node or a jQuery
378
- if (html) {
559
+ if (this.config.html) {
379
560
  if (!$(content).parent().is($element)) {
380
561
  $element.empty().append(content);
381
562
  }
382
563
  } else {
383
564
  $element.text($(content).text());
384
565
  }
566
+
567
+ return;
568
+ }
569
+
570
+ if (this.config.html) {
571
+ if (this.config.sanitize) {
572
+ content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
573
+ }
574
+
575
+ $element.html(content);
385
576
  } else {
386
- $element[html ? 'html' : 'text'](content);
577
+ $element.text(content);
387
578
  }
388
579
  };
389
580
 
@@ -395,39 +586,69 @@ var Tooltip = function ($) {
395
586
  }
396
587
 
397
588
  return title;
398
- }; // Private
589
+ } // Private
590
+ ;
591
+
592
+ _proto._getOffset = function _getOffset() {
593
+ var _this3 = this;
594
+
595
+ var offset = {};
399
596
 
597
+ if (typeof this.config.offset === 'function') {
598
+ offset.fn = function (data) {
599
+ data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {});
600
+ return data;
601
+ };
602
+ } else {
603
+ offset.offset = this.config.offset;
604
+ }
605
+
606
+ return offset;
607
+ };
608
+
609
+ _proto._getContainer = function _getContainer() {
610
+ if (this.config.container === false) {
611
+ return document.body;
612
+ }
613
+
614
+ if (Util.isElement(this.config.container)) {
615
+ return $(this.config.container);
616
+ }
617
+
618
+ return $(document).find(this.config.container);
619
+ };
400
620
 
401
621
  _proto._getAttachment = function _getAttachment(placement) {
402
622
  return AttachmentMap[placement.toUpperCase()];
403
623
  };
404
624
 
405
625
  _proto._setListeners = function _setListeners() {
406
- var _this3 = this;
626
+ var _this4 = this;
407
627
 
408
628
  var triggers = this.config.trigger.split(' ');
409
629
  triggers.forEach(function (trigger) {
410
630
  if (trigger === 'click') {
411
- $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, function (event) {
412
- return _this3.toggle(event);
631
+ $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) {
632
+ return _this4.toggle(event);
413
633
  });
414
634
  } else if (trigger !== Trigger.MANUAL) {
415
- var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
416
- var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
417
- $(_this3.element).on(eventIn, _this3.config.selector, function (event) {
418
- return _this3._enter(event);
419
- }).on(eventOut, _this3.config.selector, function (event) {
420
- return _this3._leave(event);
635
+ var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN;
636
+ var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT;
637
+ $(_this4.element).on(eventIn, _this4.config.selector, function (event) {
638
+ return _this4._enter(event);
639
+ }).on(eventOut, _this4.config.selector, function (event) {
640
+ return _this4._leave(event);
421
641
  });
422
642
  }
423
-
424
- $(_this3.element).closest('.modal').on('hide.bs.modal', function () {
425
- return _this3.hide();
426
- });
643
+ });
644
+ $(this.element).closest('.modal').on('hide.bs.modal', function () {
645
+ if (_this4.element) {
646
+ _this4.hide();
647
+ }
427
648
  });
428
649
 
429
650
  if (this.config.selector) {
430
- this.config = _extends({}, this.config, {
651
+ this.config = _objectSpread({}, this.config, {
431
652
  trigger: 'manual',
432
653
  selector: ''
433
654
  });
@@ -521,7 +742,13 @@ var Tooltip = function ($) {
521
742
  };
522
743
 
523
744
  _proto._getConfig = function _getConfig(config) {
524
- config = _extends({}, this.constructor.Default, $(this.element).data(), config);
745
+ var dataAttributes = $(this.element).data();
746
+ Object.keys(dataAttributes).forEach(function (dataAttr) {
747
+ if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
748
+ delete dataAttributes[dataAttr];
749
+ }
750
+ });
751
+ config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
525
752
 
526
753
  if (typeof config.delay === 'number') {
527
754
  config.delay = {
@@ -539,6 +766,11 @@ var Tooltip = function ($) {
539
766
  }
540
767
 
541
768
  Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
769
+
770
+ if (config.sanitize) {
771
+ config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
772
+ }
773
+
542
774
  return config;
543
775
  };
544
776
 
@@ -560,15 +792,18 @@ var Tooltip = function ($) {
560
792
  var $tip = $(this.getTipElement());
561
793
  var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
562
794
 
563
- if (tabClass !== null && tabClass.length > 0) {
795
+ if (tabClass !== null && tabClass.length) {
564
796
  $tip.removeClass(tabClass.join(''));
565
797
  }
566
798
  };
567
799
 
568
- _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(data) {
800
+ _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
801
+ var popperInstance = popperData.instance;
802
+ this.tip = popperInstance.popper;
803
+
569
804
  this._cleanTipClass();
570
805
 
571
- this.addAttachmentClass(this._getAttachment(data.placement));
806
+ this.addAttachmentClass(this._getAttachment(popperData.placement));
572
807
  };
573
808
 
574
809
  _proto._fixTransition = function _fixTransition() {
@@ -584,8 +819,8 @@ var Tooltip = function ($) {
584
819
  this.hide();
585
820
  this.show();
586
821
  this.config.animation = initConfigAnimation;
587
- }; // Static
588
-
822
+ } // Static
823
+ ;
589
824
 
590
825
  Tooltip._jQueryInterface = function _jQueryInterface(config) {
591
826
  return this.each(function () {
@@ -667,4 +902,5 @@ var Tooltip = function ($) {
667
902
  };
668
903
 
669
904
  return Tooltip;
670
- }($, Popper);
905
+
906
+ }));