bootstrap 4.6.2.1 → 5.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +0 -4
  3. data/README.md +1 -7
  4. data/Rakefile +4 -16
  5. data/assets/javascripts/bootstrap/alert.js +148 -73
  6. data/assets/javascripts/bootstrap/button.js +71 -154
  7. data/assets/javascripts/bootstrap/carousel.js +315 -209
  8. data/assets/javascripts/bootstrap/collapse.js +307 -153
  9. data/assets/javascripts/bootstrap/dom/data.js +81 -0
  10. data/assets/javascripts/bootstrap/dom/event-handler.js +311 -0
  11. data/assets/javascripts/bootstrap/dom/manipulator.js +100 -0
  12. data/assets/javascripts/bootstrap/dom/polyfill.js +110 -0
  13. data/assets/javascripts/bootstrap/dom/selector-engine.js +98 -0
  14. data/assets/javascripts/bootstrap/dropdown.js +257 -205
  15. data/assets/javascripts/bootstrap/modal.js +354 -250
  16. data/assets/javascripts/bootstrap/popover.js +85 -94
  17. data/assets/javascripts/bootstrap/scrollspy.js +179 -107
  18. data/assets/javascripts/bootstrap/tab.js +170 -99
  19. data/assets/javascripts/bootstrap/toast.js +181 -110
  20. data/assets/javascripts/bootstrap/tooltip.js +375 -226
  21. data/assets/javascripts/bootstrap-sprockets.js +5 -1
  22. data/assets/javascripts/bootstrap.js +2260 -1550
  23. data/assets/javascripts/bootstrap.min.js +3 -3
  24. data/assets/stylesheets/_bootstrap-grid.scss +53 -18
  25. data/assets/stylesheets/_bootstrap-reboot.scss +6 -3
  26. data/assets/stylesheets/_bootstrap.scss +16 -10
  27. data/assets/stylesheets/bootstrap/_alert.scss +3 -4
  28. data/assets/stylesheets/bootstrap/_badge.scss +2 -27
  29. data/assets/stylesheets/bootstrap/_breadcrumb.scss +5 -17
  30. data/assets/stylesheets/bootstrap/_button-group.scss +16 -38
  31. data/assets/stylesheets/bootstrap/_buttons.scss +27 -45
  32. data/assets/stylesheets/bootstrap/_card.scss +22 -68
  33. data/assets/stylesheets/bootstrap/_carousel.scss +15 -20
  34. data/assets/stylesheets/bootstrap/_close.scss +9 -13
  35. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  36. data/assets/stylesheets/bootstrap/_dropdown.scss +12 -9
  37. data/assets/stylesheets/bootstrap/_forms.scss +9 -347
  38. data/assets/stylesheets/bootstrap/_functions.scss +82 -69
  39. data/assets/stylesheets/bootstrap/_grid.scss +3 -54
  40. data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
  41. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  42. data/assets/stylesheets/bootstrap/_list-group.scss +7 -4
  43. data/assets/stylesheets/bootstrap/_mixins.scss +6 -12
  44. data/assets/stylesheets/bootstrap/_modal.scss +36 -41
  45. data/assets/stylesheets/bootstrap/_nav.scss +7 -9
  46. data/assets/stylesheets/bootstrap/_navbar.scss +42 -82
  47. data/assets/stylesheets/bootstrap/_pagination.scss +7 -20
  48. data/assets/stylesheets/bootstrap/_popover.scss +14 -14
  49. data/assets/stylesheets/bootstrap/_progress.scss +3 -5
  50. data/assets/stylesheets/bootstrap/_reboot.scss +304 -172
  51. data/assets/stylesheets/bootstrap/_root.scss +5 -8
  52. data/assets/stylesheets/bootstrap/_spinners.scss +8 -17
  53. data/assets/stylesheets/bootstrap/_tables.scss +80 -114
  54. data/assets/stylesheets/bootstrap/_toasts.scss +2 -4
  55. data/assets/stylesheets/bootstrap/_tooltip.scss +9 -9
  56. data/assets/stylesheets/bootstrap/_transitions.scss +0 -7
  57. data/assets/stylesheets/bootstrap/_type.scss +38 -59
  58. data/assets/stylesheets/bootstrap/_utilities.scss +503 -18
  59. data/assets/stylesheets/bootstrap/_variables.scss +548 -437
  60. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
  61. data/assets/stylesheets/bootstrap/forms/_form-check.scss +142 -0
  62. data/assets/stylesheets/bootstrap/forms/_form-control.scss +116 -0
  63. data/assets/stylesheets/bootstrap/forms/_form-file.scss +91 -0
  64. data/assets/stylesheets/bootstrap/forms/_form-range.scss +136 -0
  65. data/assets/stylesheets/bootstrap/forms/_form-select.scss +82 -0
  66. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  67. data/assets/stylesheets/bootstrap/forms/_input-group.scss +140 -0
  68. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  69. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  70. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
  71. data/assets/stylesheets/bootstrap/helpers/_embed.scss +31 -0
  72. data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
  73. data/assets/stylesheets/bootstrap/helpers/_screenreaders.scss +8 -0
  74. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  75. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  76. data/assets/stylesheets/bootstrap/mixins/_alert.scss +0 -4
  77. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +1 -1
  78. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +11 -8
  79. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +62 -47
  80. data/assets/stylesheets/bootstrap/mixins/_caret.scss +4 -4
  81. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  82. data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
  83. data/assets/stylesheets/bootstrap/mixins/_forms.scss +23 -85
  84. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +9 -11
  85. data/assets/stylesheets/bootstrap/mixins/_grid.scss +86 -34
  86. data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
  87. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -1
  88. data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
  89. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +15 -8
  90. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
  91. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +18 -24
  92. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
  93. data/assets/stylesheets/bootstrap/mixins/_transition.scss +2 -2
  94. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +49 -0
  95. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  96. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
  97. data/bootstrap.gemspec +3 -1
  98. data/lib/bootstrap/engine.rb +1 -17
  99. data/lib/bootstrap/version.rb +2 -2
  100. data/tasks/updater/js.rb +6 -18
  101. data/tasks/updater/network.rb +1 -7
  102. metadata +49 -47
  103. data/assets/javascripts/bootstrap/util.js +0 -189
  104. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  105. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
  106. data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
  107. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  108. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  109. data/assets/stylesheets/bootstrap/_print.scss +0 -132
  110. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
  111. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  112. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  113. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
  114. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  115. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
  116. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  117. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  118. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
  119. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  120. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  121. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  122. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  123. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  124. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  125. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  126. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  127. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  128. data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
  129. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  130. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  131. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  132. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  133. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  134. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  135. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  136. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  137. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  138. data/test/gemfiles/rails_7_0_dartsass.gemfile +0 -8
  139. data/test/gemfiles/rails_7_0_sassc.gemfile +0 -8
  140. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd382f63309c8fbf7da627ee4990fdaeb3e9eb7f25ba5d06f77346c0dcc68de4
4
- data.tar.gz: 2c24101f290892643a48f3d530132cca24fb35b9d05e8b19c5305056508065ac
3
+ metadata.gz: da3029d47624ce88dca2ddb395d250b689f2bea68844f66718189fd25dff9b24
4
+ data.tar.gz: 99158148a82693decf171b07d999e45eeff3ab6fa157084b5b592ecda230426c
5
5
  SHA512:
6
- metadata.gz: ed3113b844e211e9bd1875de399f167043a7b57c81d399fedaa9fb2a6e9b49dd01d1164c89801476bf6ccce66baf3c88fa88d086895cfc655429f14f821c6b2b
7
- data.tar.gz: b79d08b3e67931da95f530aea47619c1eb486f7f1cf3eae873645b875f65aec62f30018fbd169a490add197037650f0f3cca4dd11de4a7b07f603bbb6c2fb0c8
6
+ metadata.gz: e1790921eb6fefab26c74b036f316daec352870f6a9b2dfb795f0a51ae0fd65cd3c3b23f082d2de6b17bf59045bcf3db000f9ffc41c0ebfe809cabc370b79600
7
+ data.tar.gz: e2b21f142c4761d751d964b12fe4ed27b045f8df89ce87c6ad09a0d403e9e5d3ea9744f64d13a99bba76ce9058fe1e5f3f892804ff55a388dd630d2a1a60dfa0
data/CHANGELOG.md CHANGED
@@ -6,10 +6,6 @@ The changelog only includes changes specific to the RubyGem.
6
6
  The Bootstrap framework changes can be found in [the Releases section of twbs/bootstrap](https://github.com/twbs/bootstrap/releases).
7
7
  Release announcement posts on [the official Bootstrap blog](http://blog.getbootstrap.com) contain summaries of the most noteworthy changes made in each release of Bootstrap.
8
8
 
9
- # 4.6.2.1
10
-
11
- * Adds support for other Sass compilers. [#278](https://github.com/twbs/bootstrap-rubygem/pull/278)
12
-
13
9
  # 4.2.1
14
10
 
15
11
  * Bootstrap rubygem now depends on SassC instead of Sass.
data/README.md CHANGED
@@ -17,15 +17,9 @@ Please see the appropriate guide for your environment of choice:
17
17
  Add `bootstrap` to your Gemfile:
18
18
 
19
19
  ```ruby
20
- gem 'bootstrap', '~> 4.6.2.1'
20
+ gem 'bootstrap', '~> 5.0.0.alpha1'
21
21
  ```
22
22
 
23
- This gem requires a Sass engine, so make sure you have **one** of these four gems in your Gemfile:
24
- - [`dartsass-sprockets`](https://github.com/tablecheck/dartsass-sprockets): Dart Sass engine, recommended but only works for Ruby 2.6+ and Rails 5+
25
- - [`dartsass-rails`](https://github.com/rails/dartsass-rails): Dart Sass engine, recommended for Rails projects that use Propshaft
26
- - [`cssbundling-rails`](https://github.com/rails/cssbundling-rails): External Sass engine
27
- - [`sassc-rails`](https://github.com/sass/sassc-rails): SassC engine, deprecated but compatible with Ruby 2.3+ and Rails 4
28
-
29
23
  Ensure that `sprockets-rails` is at least v2.3.2.
30
24
 
31
25
  `bundle install` and restart your server to make the files available through the pipeline.
data/Rakefile CHANGED
@@ -45,28 +45,16 @@ end
45
45
 
46
46
  desc 'Dumps output to a CSS file for testing'
47
47
  task :debug do
48
- begin
49
- require 'sass-embedded'
50
- rescue LoadError
51
- begin
52
- require 'sassc'
53
- rescue LoadError
54
- raise LoadError.new("bootstrap-rubygem requires a Sass engine. Please add dartsass-sprockets or sassc-rails to your dependencies.")
55
- end
56
- end
48
+ require 'sassc'
57
49
  require './lib/bootstrap'
58
50
  require 'term/ansicolor'
59
51
  require 'autoprefixer-rails'
60
52
  path = Bootstrap.stylesheets_path
61
53
  %w(_bootstrap _bootstrap-reboot _bootstrap-grid).each do |file|
62
- filename = "#{path}/#{file}.scss"
63
- css = if defined?(SassC::Engine)
64
- SassC::Engine.new(File.read(filename), filename: filename, syntax: :scss).render
65
- else
66
- Sass.compile(filename).css
67
- end
68
- css = AutoprefixerRails.process(css)
54
+ engine = SassC::Engine.new(File.read("#{path}/#{file}.scss"), syntax: :scss, load_paths: [path])
69
55
  out = File.join('tmp', "#{file[1..-1]}.css")
56
+ css = engine.render
57
+ css = AutoprefixerRails.process(css)
70
58
  File.write(out, css)
71
59
  $stderr.puts Term::ANSIColor.green "Compiled #{out}"
72
60
  end
@@ -1,62 +1,132 @@
1
1
  /*!
2
- * Bootstrap alert.js v4.6.2 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap alert.js v5.0.0-alpha1 (https://getbootstrap.com/)
3
+ * Copyright 2011-2020 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
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
8
- typeof define === 'function' && define.amd ? define(['jquery', './util'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.jQuery, global.Util));
10
- })(this, (function ($, Util) { 'use strict';
11
-
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
-
14
- var $__default = /*#__PURE__*/_interopDefaultLegacy($);
15
- var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util);
16
-
17
- function _defineProperties(target, props) {
18
- for (var i = 0; i < props.length; i++) {
19
- var descriptor = props[i];
20
- descriptor.enumerable = descriptor.enumerable || false;
21
- descriptor.configurable = true;
22
- if ("value" in descriptor) descriptor.writable = true;
23
- Object.defineProperty(target, descriptor.key, descriptor);
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js'], factory) :
9
+ (global = global || self, global.Alert = factory(global.Data, global.EventHandler));
10
+ }(this, (function (Data, EventHandler) { 'use strict';
11
+
12
+ Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
13
+ EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
14
+
15
+ /**
16
+ * --------------------------------------------------------------------------
17
+ * Bootstrap (v5.0.0-alpha1): util/index.js
18
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
19
+ * --------------------------------------------------------------------------
20
+ */
21
+ var MILLISECONDS_MULTIPLIER = 1000;
22
+ var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
23
+
24
+ var getSelector = function getSelector(element) {
25
+ var selector = element.getAttribute('data-target');
26
+
27
+ if (!selector || selector === '#') {
28
+ var hrefAttr = element.getAttribute('href');
29
+ selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
24
30
  }
25
- }
26
31
 
27
- function _createClass(Constructor, protoProps, staticProps) {
28
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
29
- if (staticProps) _defineProperties(Constructor, staticProps);
30
- Object.defineProperty(Constructor, "prototype", {
31
- writable: false
32
- });
33
- return Constructor;
34
- }
32
+ return selector;
33
+ };
34
+
35
+ var getElementFromSelector = function getElementFromSelector(element) {
36
+ var selector = getSelector(element);
37
+ return selector ? document.querySelector(selector) : null;
38
+ };
39
+
40
+ var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
41
+ if (!element) {
42
+ return 0;
43
+ } // Get transition-duration of the element
44
+
35
45
 
46
+ var _window$getComputedSt = window.getComputedStyle(element),
47
+ transitionDuration = _window$getComputedSt.transitionDuration,
48
+ transitionDelay = _window$getComputedSt.transitionDelay;
49
+
50
+ var floatTransitionDuration = parseFloat(transitionDuration);
51
+ var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
52
+
53
+ if (!floatTransitionDuration && !floatTransitionDelay) {
54
+ return 0;
55
+ } // If multiple durations are defined, take the first
56
+
57
+
58
+ transitionDuration = transitionDuration.split(',')[0];
59
+ transitionDelay = transitionDelay.split(',')[0];
60
+ return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
61
+ };
62
+
63
+ var triggerTransitionEnd = function triggerTransitionEnd(element) {
64
+ element.dispatchEvent(new Event(TRANSITION_END));
65
+ };
66
+
67
+ var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
68
+ var called = false;
69
+ var durationPadding = 5;
70
+ var emulatedDuration = duration + durationPadding;
71
+
72
+ function listener() {
73
+ called = true;
74
+ element.removeEventListener(TRANSITION_END, listener);
75
+ }
76
+
77
+ element.addEventListener(TRANSITION_END, listener);
78
+ setTimeout(function () {
79
+ if (!called) {
80
+ triggerTransitionEnd(element);
81
+ }
82
+ }, emulatedDuration);
83
+ };
84
+
85
+ var getjQuery = function getjQuery() {
86
+ var _window = window,
87
+ jQuery = _window.jQuery;
88
+
89
+ if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
90
+ return jQuery;
91
+ }
92
+
93
+ return null;
94
+ };
95
+
96
+ 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); } }
97
+
98
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
36
99
  /**
100
+ * ------------------------------------------------------------------------
37
101
  * Constants
102
+ * ------------------------------------------------------------------------
38
103
  */
39
104
 
40
105
  var NAME = 'alert';
41
- var VERSION = '4.6.2';
106
+ var VERSION = '5.0.0-alpha1';
42
107
  var DATA_KEY = 'bs.alert';
43
108
  var EVENT_KEY = "." + DATA_KEY;
44
109
  var DATA_API_KEY = '.data-api';
45
- var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
46
- var CLASS_NAME_ALERT = 'alert';
47
- var CLASS_NAME_FADE = 'fade';
48
- var CLASS_NAME_SHOW = 'show';
110
+ var SELECTOR_DISMISS = '[data-dismiss="alert"]';
49
111
  var EVENT_CLOSE = "close" + EVENT_KEY;
50
112
  var EVENT_CLOSED = "closed" + EVENT_KEY;
51
113
  var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
52
- var SELECTOR_DISMISS = '[data-dismiss="alert"]';
114
+ var CLASSNAME_ALERT = 'alert';
115
+ var CLASSNAME_FADE = 'fade';
116
+ var CLASSNAME_SHOW = 'show';
53
117
  /**
54
- * Class definition
118
+ * ------------------------------------------------------------------------
119
+ * Class Definition
120
+ * ------------------------------------------------------------------------
55
121
  */
56
122
 
57
123
  var Alert = /*#__PURE__*/function () {
58
124
  function Alert(element) {
59
125
  this._element = element;
126
+
127
+ if (this._element) {
128
+ Data.setData(element, DATA_KEY, this);
129
+ }
60
130
  } // Getters
61
131
 
62
132
 
@@ -72,7 +142,7 @@
72
142
 
73
143
  var customEvent = this._triggerCloseEvent(rootElement);
74
144
 
75
- if (customEvent.isDefaultPrevented()) {
145
+ if (customEvent === null || customEvent.defaultPrevented) {
76
146
  return;
77
147
  }
78
148
 
@@ -80,62 +150,52 @@
80
150
  };
81
151
 
82
152
  _proto.dispose = function dispose() {
83
- $__default["default"].removeData(this._element, DATA_KEY);
153
+ Data.removeData(this._element, DATA_KEY);
84
154
  this._element = null;
85
155
  } // Private
86
156
  ;
87
157
 
88
158
  _proto._getRootElement = function _getRootElement(element) {
89
- var selector = Util__default["default"].getSelectorFromElement(element);
90
- var parent = false;
91
-
92
- if (selector) {
93
- parent = document.querySelector(selector);
94
- }
95
-
96
- if (!parent) {
97
- parent = $__default["default"](element).closest("." + CLASS_NAME_ALERT)[0];
98
- }
99
-
100
- return parent;
159
+ return getElementFromSelector(element) || element.closest("." + CLASSNAME_ALERT);
101
160
  };
102
161
 
103
162
  _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
104
- var closeEvent = $__default["default"].Event(EVENT_CLOSE);
105
- $__default["default"](element).trigger(closeEvent);
106
- return closeEvent;
163
+ return EventHandler.trigger(element, EVENT_CLOSE);
107
164
  };
108
165
 
109
166
  _proto._removeElement = function _removeElement(element) {
110
167
  var _this = this;
111
168
 
112
- $__default["default"](element).removeClass(CLASS_NAME_SHOW);
169
+ element.classList.remove(CLASSNAME_SHOW);
113
170
 
114
- if (!$__default["default"](element).hasClass(CLASS_NAME_FADE)) {
171
+ if (!element.classList.contains(CLASSNAME_FADE)) {
115
172
  this._destroyElement(element);
116
173
 
117
174
  return;
118
175
  }
119
176
 
120
- var transitionDuration = Util__default["default"].getTransitionDurationFromElement(element);
121
- $__default["default"](element).one(Util__default["default"].TRANSITION_END, function (event) {
122
- return _this._destroyElement(element, event);
123
- }).emulateTransitionEnd(transitionDuration);
177
+ var transitionDuration = getTransitionDurationFromElement(element);
178
+ EventHandler.one(element, TRANSITION_END, function () {
179
+ return _this._destroyElement(element);
180
+ });
181
+ emulateTransitionEnd(element, transitionDuration);
124
182
  };
125
183
 
126
184
  _proto._destroyElement = function _destroyElement(element) {
127
- $__default["default"](element).detach().trigger(EVENT_CLOSED).remove();
185
+ if (element.parentNode) {
186
+ element.parentNode.removeChild(element);
187
+ }
188
+
189
+ EventHandler.trigger(element, EVENT_CLOSED);
128
190
  } // Static
129
191
  ;
130
192
 
131
- Alert._jQueryInterface = function _jQueryInterface(config) {
193
+ Alert.jQueryInterface = function jQueryInterface(config) {
132
194
  return this.each(function () {
133
- var $element = $__default["default"](this);
134
- var data = $element.data(DATA_KEY);
195
+ var data = Data.getData(this, DATA_KEY);
135
196
 
136
197
  if (!data) {
137
198
  data = new Alert(this);
138
- $element.data(DATA_KEY, data);
139
199
  }
140
200
 
141
201
  if (config === 'close') {
@@ -144,7 +204,7 @@
144
204
  });
145
205
  };
146
206
 
147
- Alert._handleDismiss = function _handleDismiss(alertInstance) {
207
+ Alert.handleDismiss = function handleDismiss(alertInstance) {
148
208
  return function (event) {
149
209
  if (event) {
150
210
  event.preventDefault();
@@ -154,6 +214,10 @@
154
214
  };
155
215
  };
156
216
 
217
+ Alert.getInstance = function getInstance(element) {
218
+ return Data.getData(element, DATA_KEY);
219
+ };
220
+
157
221
  _createClass(Alert, null, [{
158
222
  key: "VERSION",
159
223
  get: function get() {
@@ -164,23 +228,34 @@
164
228
  return Alert;
165
229
  }();
166
230
  /**
167
- * Data API implementation
231
+ * ------------------------------------------------------------------------
232
+ * Data Api implementation
233
+ * ------------------------------------------------------------------------
168
234
  */
169
235
 
170
236
 
171
- $__default["default"](document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert()));
237
+ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
238
+ var $ = getjQuery();
172
239
  /**
240
+ * ------------------------------------------------------------------------
173
241
  * jQuery
242
+ * ------------------------------------------------------------------------
243
+ * add .alert to jQuery only if jQuery is present
174
244
  */
175
245
 
176
- $__default["default"].fn[NAME] = Alert._jQueryInterface;
177
- $__default["default"].fn[NAME].Constructor = Alert;
246
+ /* istanbul ignore if */
178
247
 
179
- $__default["default"].fn[NAME].noConflict = function () {
180
- $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;
181
- return Alert._jQueryInterface;
182
- };
248
+ if ($) {
249
+ var JQUERY_NO_CONFLICT = $.fn[NAME];
250
+ $.fn[NAME] = Alert.jQueryInterface;
251
+ $.fn[NAME].Constructor = Alert;
252
+
253
+ $.fn[NAME].noConflict = function () {
254
+ $.fn[NAME] = JQUERY_NO_CONFLICT;
255
+ return Alert.jQueryInterface;
256
+ };
257
+ }
183
258
 
184
259
  return Alert;
185
260
 
186
- }));
261
+ })));