bootstrap 4.0.0.alpha6 → 4.0.0.beta

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 (97) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/Gemfile +2 -4
  4. data/README.md +20 -22
  5. data/assets/javascripts/bootstrap.js +657 -361
  6. data/assets/javascripts/bootstrap.min.js +2 -3
  7. data/assets/javascripts/bootstrap/alert.js +8 -8
  8. data/assets/javascripts/bootstrap/button.js +16 -9
  9. data/assets/javascripts/bootstrap/carousel.js +48 -21
  10. data/assets/javascripts/bootstrap/collapse.js +42 -33
  11. data/assets/javascripts/bootstrap/dropdown.js +196 -52
  12. data/assets/javascripts/bootstrap/modal.js +71 -29
  13. data/assets/javascripts/bootstrap/popover.js +25 -13
  14. data/assets/javascripts/bootstrap/scrollspy.js +23 -21
  15. data/assets/javascripts/bootstrap/tab.js +14 -18
  16. data/assets/javascripts/bootstrap/tooltip.js +139 -83
  17. data/assets/javascripts/bootstrap/util.js +10 -8
  18. data/assets/stylesheets/_bootstrap-grid.scss +2 -8
  19. data/assets/stylesheets/_bootstrap-reboot.scss +1 -2
  20. data/assets/stylesheets/_bootstrap.scss +2 -15
  21. data/assets/stylesheets/bootstrap/_alert.scss +4 -11
  22. data/assets/stylesheets/bootstrap/_badge.scss +4 -33
  23. data/assets/stylesheets/bootstrap/_breadcrumb.scss +1 -1
  24. data/assets/stylesheets/bootstrap/_button-group.scss +11 -15
  25. data/assets/stylesheets/bootstrap/_buttons.scss +13 -42
  26. data/assets/stylesheets/bootstrap/_card.scss +27 -80
  27. data/assets/stylesheets/bootstrap/_carousel.scss +24 -17
  28. data/assets/stylesheets/bootstrap/_close.scss +0 -2
  29. data/assets/stylesheets/bootstrap/_custom-forms.scss +27 -36
  30. data/assets/stylesheets/bootstrap/_dropdown.scss +15 -48
  31. data/assets/stylesheets/bootstrap/_forms.scss +70 -68
  32. data/assets/stylesheets/bootstrap/_functions.scss +90 -0
  33. data/assets/stylesheets/bootstrap/_grid.scss +3 -2
  34. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  35. data/assets/stylesheets/bootstrap/_input-group.scss +6 -8
  36. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -4
  37. data/assets/stylesheets/bootstrap/_list-group.scss +9 -36
  38. data/assets/stylesheets/bootstrap/_mixins.scss +2 -18
  39. data/assets/stylesheets/bootstrap/_modal.scss +3 -3
  40. data/assets/stylesheets/bootstrap/_nav.scss +15 -16
  41. data/assets/stylesheets/bootstrap/_navbar.scss +70 -54
  42. data/assets/stylesheets/bootstrap/_pagination.scss +3 -4
  43. data/assets/stylesheets/bootstrap/_popover.scss +96 -72
  44. data/assets/stylesheets/bootstrap/_print.scss +1 -9
  45. data/assets/stylesheets/bootstrap/_progress.scss +4 -4
  46. data/assets/stylesheets/bootstrap/_reboot.scss +187 -95
  47. data/assets/stylesheets/bootstrap/_tables.scss +34 -19
  48. data/assets/stylesheets/bootstrap/_tooltip.scss +52 -35
  49. data/assets/stylesheets/bootstrap/_type.scss +8 -28
  50. data/assets/stylesheets/bootstrap/_utilities.scss +1 -0
  51. data/assets/stylesheets/bootstrap/_variables.scss +286 -410
  52. data/assets/stylesheets/bootstrap/mixins/_alert.scss +4 -5
  53. data/assets/stylesheets/bootstrap/mixins/_badge.scss +6 -5
  54. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +3 -3
  55. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +5 -0
  56. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +23 -13
  57. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +11 -14
  58. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +1 -1
  59. data/assets/stylesheets/bootstrap/mixins/_forms.scss +57 -55
  60. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +1 -1
  61. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +9 -18
  62. data/assets/stylesheets/bootstrap/mixins/_grid.scss +12 -65
  63. data/assets/stylesheets/bootstrap/mixins/_hover.scss +6 -6
  64. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -4
  65. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +3 -3
  66. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +1 -0
  67. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +4 -3
  68. data/assets/stylesheets/bootstrap/mixins/_resize.scss +1 -1
  69. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +5 -2
  70. data/assets/stylesheets/bootstrap/mixins/_text-truncate.scss +1 -1
  71. data/assets/stylesheets/bootstrap/mixins/_transition.scss +9 -0
  72. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +2 -2
  73. data/assets/stylesheets/bootstrap/utilities/_background.scss +4 -17
  74. data/assets/stylesheets/bootstrap/utilities/_borders.scss +20 -5
  75. data/assets/stylesheets/bootstrap/utilities/_display.scss +36 -1
  76. data/assets/stylesheets/bootstrap/{_responsive-embed.scss → utilities/_embed.scss} +0 -0
  77. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -4
  78. data/assets/stylesheets/bootstrap/utilities/_position.scss +5 -3
  79. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +10 -12
  80. data/assets/stylesheets/bootstrap/utilities/_text.scss +5 -17
  81. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +4 -48
  82. data/bootstrap.gemspec +2 -0
  83. data/lib/bootstrap.rb +2 -0
  84. data/lib/bootstrap/version.rb +2 -2
  85. data/tasks/updater/js.rb +7 -9
  86. data/tasks/updater/scss.rb +1 -4
  87. data/templates/project/_bootstrap-variables.scss +289 -396
  88. data/test/dummy_rails/app/assets/javascripts/application.js +1 -1
  89. data/test/dummy_rails/config/application.rb +0 -1
  90. data/test/gemfiles/rails_4_2.gemfile +0 -4
  91. data/test/gemfiles/rails_5_0.gemfile +0 -4
  92. data/test/gemfiles/rails_5_1.gemfile +8 -0
  93. metadata +23 -8
  94. data/assets/stylesheets/bootstrap/_custom.scss +0 -4
  95. data/assets/stylesheets/bootstrap/_normalize.scss +0 -461
  96. data/assets/stylesheets/bootstrap/mixins/_cards.scss +0 -47
  97. data/assets/stylesheets/bootstrap/mixins/_transforms.scss +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d180a69e0c7dbefd63219ca59c3baffae843676
4
- data.tar.gz: b757df00875d03cc153c13e4aa27dd1d013fbce9
3
+ metadata.gz: 97fbb9e5cfea607e79bbd08dd736729354a2ddbf
4
+ data.tar.gz: 9a8a3970536c6b5550a7e6e3fa7a5d02d8ec25ea
5
5
  SHA512:
6
- metadata.gz: 776760a7de9f3b666eaae0cb084412d11385e441536d610c4b31b756bed9f6e9a1cdc9f183c7be44076718a26a920f845b85dcc14fa4ef68e660f1f2dbc4b542
7
- data.tar.gz: e259b489f25fe9afa1df5c85abce20ab1c474d940c0980b1eca95ed0fb92814ab81994030b4c4f7fb4af4916442088307f4e21b9cf875a5d29b2a00625d7be11
6
+ metadata.gz: '099711794d8747be377b157746a7a249a44b0aab8ae144b0532b597d1397d808d160ba86b07c4c9b3310e606122ce68aa5a5fd0009cd22a8e1db8b0f6a167952'
7
+ data.tar.gz: 18fbebcb9e5484593ea9b77ec973c5740059f4af1fde49be0c53a0e4b3b176b753c178392703b341b7f0b21526256f2e71750fbb38c594ea8070ba7674da43fb
data/.travis.yml CHANGED
@@ -5,6 +5,7 @@ rvm:
5
5
  gemfile:
6
6
  - test/gemfiles/rails_4_2.gemfile
7
7
  - test/gemfiles/rails_5_0.gemfile
8
+ - test/gemfiles/rails_5_1.gemfile
8
9
  cache: bundler
9
10
  bundler_args: --path ../../vendor/bundle --without debug
10
11
  notifications:
data/Gemfile CHANGED
@@ -3,11 +3,9 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :development do
6
- source 'https://rails-assets.org' do
7
- gem 'rails-assets-tether', '>= 1.1.0'
8
- end
6
+ gem 'popper_js', '>= 1.9.9'
9
7
  end
10
8
 
11
9
  group :debug do
12
- gem 'byebug', platforms: [:mri_21, :mri_22], require: false
10
+ gem 'byebug', platforms: [:mri], require: false
13
11
  end
data/README.md CHANGED
@@ -17,7 +17,7 @@ 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.0.0.alpha6'
20
+ gem 'bootstrap', '~> 4.0.0.beta'
21
21
  ```
22
22
 
23
23
  Ensure that `sprockets-rails` is at least v2.3.2.
@@ -44,35 +44,33 @@ Then, remove all the `*= require` and `*= require_tree` statements from the Sass
44
44
 
45
45
  Do not use `*= require` in Sass or your other stylesheets will not be able to access the Bootstrap mixins and variables.
46
46
 
47
- Require Bootstrap Javascripts in `app/assets/javascripts/application.js`:
47
+ Bootstrap JavaScript depends on jQuery.
48
+ If you're using Rails 5.1+, add the `jquery-rails` gem to your Gemfile:
48
49
 
49
- ```js
50
- //= require jquery
51
- //= require bootstrap-sprockets
50
+ ```ruby
51
+ gem 'jquery-rails'
52
52
  ```
53
53
 
54
- While `bootstrap-sprockets` provides individual Bootstrap components for ease of debugging, you may alternatively require the concatenated `bootstrap` for faster compilation:
55
-
56
- ```js
57
- //= require jquery
58
- //= require bootstrap
59
- ```
54
+ Bootstrap tooltips and popovers depend on [popper.js] for positioning.
55
+ The `bootstrap` gem already depends on the
56
+ [popper_js](https://github.com/glebm/popper_js-rubygem) gem.
60
57
 
61
- Tooltips and popovers depend on [tether][tether] for positioning.
62
- If you use them, add tether to the Gemfile:
58
+ Add Bootstrap dependencies and Bootstrap to your `application.js`:
63
59
 
64
- ```ruby
65
- source 'https://rails-assets.org' do
66
- gem 'rails-assets-tether', '>= 1.3.3'
67
- end
60
+ ```js
61
+ //= require jquery3
62
+ //= require popper
63
+ //= require bootstrap-sprockets
68
64
  ```
69
65
 
70
- Then, run `bundle`, restart the server, and require tether before bootstrap but after jQuery:
66
+ While `bootstrap-sprockets` provides individual Bootstrap components
67
+ for ease of debugging, you may alternatively require
68
+ the concatenated `bootstrap` for faster compilation:
71
69
 
72
70
  ```js
73
- //= require jquery
74
- //= require tether
75
- //= require bootstrap-sprockets
71
+ //= require jquery3
72
+ //= require popper
73
+ //= require bootstrap
76
74
  ```
77
75
 
78
76
  ### b. Compass without Rails
@@ -143,4 +141,4 @@ In the application Sass file, replace `@import 'bootstrap'` with:
143
141
  [bootstrap-home]: http://v4-alpha.getbootstrap.com/
144
142
  [bootstrap-variables.scss]: https://github.com/twbs/bootstrap-rubygem/blob/master/templates/project/_bootstrap-variables.scss
145
143
  [autoprefixer]: https://github.com/ai/autoprefixer
146
- [tether]: http://github.hubspot.com/tether/
144
+ [popper.js]: https://popper.js.org
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap v4.0.0-alpha.6 (https://getbootstrap.com)
2
+ * Bootstrap v4.0.0-beta (https://getbootstrap.com)
3
3
  * Copyright 2011-2017 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5
5
  */
@@ -8,16 +8,14 @@ if (typeof jQuery === 'undefined') {
8
8
  throw new Error('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.')
9
9
  }
10
10
 
11
- +function ($) {
11
+ (function ($) {
12
12
  var version = $.fn.jquery.split(' ')[0].split('.')
13
13
  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] >= 4)) {
14
14
  throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0')
15
15
  }
16
- }(jQuery);
17
-
18
-
19
- +function () {
16
+ })(jQuery);
20
17
 
18
+ (function () {
21
19
  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; };
22
20
 
23
21
  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; }; }();
@@ -30,7 +28,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
30
28
 
31
29
  /**
32
30
  * --------------------------------------------------------------------------
33
- * Bootstrap (v4.0.0-alpha.6): util.js
31
+ * Bootstrap (v4.0.0-beta): util.js
34
32
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
35
33
  * --------------------------------------------------------------------------
36
34
  */
@@ -52,10 +50,9 @@ var Util = function ($) {
52
50
  MozTransition: 'transitionend',
53
51
  OTransition: 'oTransitionEnd otransitionend',
54
52
  transition: 'transitionend'
55
- };
56
53
 
57
- // shoutout AngusCroll (https://goo.gl/pxwQGp)
58
- function toType(obj) {
54
+ // shoutout AngusCroll (https://goo.gl/pxwQGp)
55
+ };function toType(obj) {
59
56
  return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
60
57
  }
61
58
 
@@ -141,13 +138,16 @@ var Util = function ($) {
141
138
  },
142
139
  getSelectorFromElement: function getSelectorFromElement(element) {
143
140
  var selector = element.getAttribute('data-target');
144
-
145
- if (!selector) {
141
+ if (!selector || selector === '#') {
146
142
  selector = element.getAttribute('href') || '';
147
- selector = /^#[a-z]/i.test(selector) ? selector : null;
148
143
  }
149
144
 
150
- return selector;
145
+ try {
146
+ var $selector = $(selector);
147
+ return $selector.length > 0 ? selector : null;
148
+ } catch (error) {
149
+ return null;
150
+ }
151
151
  },
152
152
  reflow: function reflow(element) {
153
153
  return element.offsetHeight;
@@ -180,7 +180,7 @@ var Util = function ($) {
180
180
 
181
181
  /**
182
182
  * --------------------------------------------------------------------------
183
- * Bootstrap (v4.0.0-alpha.6): alert.js
183
+ * Bootstrap (v4.0.0-beta): alert.js
184
184
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
185
185
  * --------------------------------------------------------------------------
186
186
  */
@@ -194,7 +194,7 @@ var Alert = function ($) {
194
194
  */
195
195
 
196
196
  var NAME = 'alert';
197
- var VERSION = '4.0.0-alpha.6';
197
+ var VERSION = '4.0.0-beta';
198
198
  var DATA_KEY = 'bs.alert';
199
199
  var EVENT_KEY = '.' + DATA_KEY;
200
200
  var DATA_API_KEY = '.data-api';
@@ -215,14 +215,14 @@ var Alert = function ($) {
215
215
  ALERT: 'alert',
216
216
  FADE: 'fade',
217
217
  SHOW: 'show'
218
- };
219
218
 
220
- /**
221
- * ------------------------------------------------------------------------
222
- * Class Definition
223
- * ------------------------------------------------------------------------
224
- */
219
+ /**
220
+ * ------------------------------------------------------------------------
221
+ * Class Definition
222
+ * ------------------------------------------------------------------------
223
+ */
225
224
 
225
+ };
226
226
  var Alert = function () {
227
227
  function Alert(element) {
228
228
  _classCallCheck(this, Alert);
@@ -359,7 +359,7 @@ var Alert = function ($) {
359
359
 
360
360
  /**
361
361
  * --------------------------------------------------------------------------
362
- * Bootstrap (v4.0.0-alpha.6): button.js
362
+ * Bootstrap (v4.0.0-beta): button.js
363
363
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
364
364
  * --------------------------------------------------------------------------
365
365
  */
@@ -373,7 +373,7 @@ var Button = function ($) {
373
373
  */
374
374
 
375
375
  var NAME = 'button';
376
- var VERSION = '4.0.0-alpha.6';
376
+ var VERSION = '4.0.0-beta';
377
377
  var DATA_KEY = 'bs.button';
378
378
  var EVENT_KEY = '.' + DATA_KEY;
379
379
  var DATA_API_KEY = '.data-api';
@@ -396,14 +396,14 @@ var Button = function ($) {
396
396
  var Event = {
397
397
  CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
398
398
  FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + DATA_API_KEY)
399
- };
400
399
 
401
- /**
402
- * ------------------------------------------------------------------------
403
- * Class Definition
404
- * ------------------------------------------------------------------------
405
- */
400
+ /**
401
+ * ------------------------------------------------------------------------
402
+ * Class Definition
403
+ * ------------------------------------------------------------------------
404
+ */
406
405
 
406
+ };
407
407
  var Button = function () {
408
408
  function Button(element) {
409
409
  _classCallCheck(this, Button);
@@ -417,6 +417,7 @@ var Button = function ($) {
417
417
 
418
418
  Button.prototype.toggle = function toggle() {
419
419
  var triggerChangeEvent = true;
420
+ var addAriaPressed = true;
420
421
  var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
421
422
 
422
423
  if (rootElement) {
@@ -436,15 +437,21 @@ var Button = function ($) {
436
437
  }
437
438
 
438
439
  if (triggerChangeEvent) {
440
+ if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
441
+ return;
442
+ }
439
443
  input.checked = !$(this._element).hasClass(ClassName.ACTIVE);
440
444
  $(input).trigger('change');
441
445
  }
442
446
 
443
447
  input.focus();
448
+ addAriaPressed = false;
444
449
  }
445
450
  }
446
451
 
447
- this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
452
+ if (addAriaPressed) {
453
+ this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
454
+ }
448
455
 
449
456
  if (triggerChangeEvent) {
450
457
  $(this._element).toggleClass(ClassName.ACTIVE);
@@ -522,7 +529,7 @@ var Button = function ($) {
522
529
 
523
530
  /**
524
531
  * --------------------------------------------------------------------------
525
- * Bootstrap (v4.0.0-alpha.6): carousel.js
532
+ * Bootstrap (v4.0.0-beta): carousel.js
526
533
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
527
534
  * --------------------------------------------------------------------------
528
535
  */
@@ -536,7 +543,7 @@ var Carousel = function ($) {
536
543
  */
537
544
 
538
545
  var NAME = 'carousel';
539
- var VERSION = '4.0.0-alpha.6';
546
+ var VERSION = '4.0.0-beta';
540
547
  var DATA_KEY = 'bs.carousel';
541
548
  var EVENT_KEY = '.' + DATA_KEY;
542
549
  var DATA_API_KEY = '.data-api';
@@ -544,6 +551,7 @@ var Carousel = function ($) {
544
551
  var TRANSITION_DURATION = 600;
545
552
  var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
546
553
  var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
554
+ var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
547
555
 
548
556
  var Default = {
549
557
  interval: 5000,
@@ -574,6 +582,7 @@ var Carousel = function ($) {
574
582
  KEYDOWN: 'keydown' + EVENT_KEY,
575
583
  MOUSEENTER: 'mouseenter' + EVENT_KEY,
576
584
  MOUSELEAVE: 'mouseleave' + EVENT_KEY,
585
+ TOUCHEND: 'touchend' + EVENT_KEY,
577
586
  LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY,
578
587
  CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
579
588
  };
@@ -597,14 +606,14 @@ var Carousel = function ($) {
597
606
  INDICATORS: '.carousel-indicators',
598
607
  DATA_SLIDE: '[data-slide], [data-slide-to]',
599
608
  DATA_RIDE: '[data-ride="carousel"]'
600
- };
601
609
 
602
- /**
603
- * ------------------------------------------------------------------------
604
- * Class Definition
605
- * ------------------------------------------------------------------------
606
- */
610
+ /**
611
+ * ------------------------------------------------------------------------
612
+ * Class Definition
613
+ * ------------------------------------------------------------------------
614
+ */
607
615
 
616
+ };
608
617
  var Carousel = function () {
609
618
  function Carousel(element, config) {
610
619
  _classCallCheck(this, Carousel);
@@ -616,6 +625,8 @@ var Carousel = function ($) {
616
625
  this._isPaused = false;
617
626
  this._isSliding = false;
618
627
 
628
+ this.touchTimeout = null;
629
+
619
630
  this._config = this._getConfig(config);
620
631
  this._element = $(element)[0];
621
632
  this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0];
@@ -628,10 +639,9 @@ var Carousel = function ($) {
628
639
  // public
629
640
 
630
641
  Carousel.prototype.next = function next() {
631
- if (this._isSliding) {
632
- throw new Error('Carousel is sliding');
642
+ if (!this._isSliding) {
643
+ this._slide(Direction.NEXT);
633
644
  }
634
- this._slide(Direction.NEXT);
635
645
  };
636
646
 
637
647
  Carousel.prototype.nextWhenVisible = function nextWhenVisible() {
@@ -642,10 +652,9 @@ var Carousel = function ($) {
642
652
  };
643
653
 
644
654
  Carousel.prototype.prev = function prev() {
645
- if (this._isSliding) {
646
- throw new Error('Carousel is sliding');
655
+ if (!this._isSliding) {
656
+ this._slide(Direction.PREV);
647
657
  }
648
- this._slide(Direction.PREVIOUS);
649
658
  };
650
659
 
651
660
  Carousel.prototype.pause = function pause(event) {
@@ -701,7 +710,7 @@ var Carousel = function ($) {
701
710
  return;
702
711
  }
703
712
 
704
- var direction = index > activeIndex ? Direction.NEXT : Direction.PREVIOUS;
713
+ var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
705
714
 
706
715
  this._slide(direction, this._items[index]);
707
716
  };
@@ -737,12 +746,30 @@ var Carousel = function ($) {
737
746
  });
738
747
  }
739
748
 
740
- if (this._config.pause === 'hover' && !('ontouchstart' in document.documentElement)) {
749
+ if (this._config.pause === 'hover') {
741
750
  $(this._element).on(Event.MOUSEENTER, function (event) {
742
751
  return _this4.pause(event);
743
752
  }).on(Event.MOUSELEAVE, function (event) {
744
753
  return _this4.cycle(event);
745
754
  });
755
+ if ('ontouchstart' in document.documentElement) {
756
+ // if it's a touch-enabled device, mouseenter/leave are fired as
757
+ // part of the mouse compatibility events on first tap - the carousel
758
+ // would stop cycling until user tapped out of it;
759
+ // here, we listen for touchend, explicitly pause the carousel
760
+ // (as if it's the second time we tap on it, mouseenter compat event
761
+ // is NOT fired) and after a timeout (to allow for mouse compatibility
762
+ // events to fire) we explicitly restart cycling
763
+ $(this._element).on(Event.TOUCHEND, function () {
764
+ _this4.pause();
765
+ if (_this4.touchTimeout) {
766
+ clearTimeout(_this4.touchTimeout);
767
+ }
768
+ _this4.touchTimeout = setTimeout(function (event) {
769
+ return _this4.cycle(event);
770
+ }, TOUCHEVENT_COMPAT_WAIT + _this4._config.interval);
771
+ });
772
+ }
746
773
  }
747
774
  };
748
775
 
@@ -772,7 +799,7 @@ var Carousel = function ($) {
772
799
 
773
800
  Carousel.prototype._getItemByDirection = function _getItemByDirection(direction, activeElement) {
774
801
  var isNextDirection = direction === Direction.NEXT;
775
- var isPrevDirection = direction === Direction.PREVIOUS;
802
+ var isPrevDirection = direction === Direction.PREV;
776
803
  var activeIndex = this._getItemIndex(activeElement);
777
804
  var lastItemIndex = this._items.length - 1;
778
805
  var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
@@ -781,16 +808,20 @@ var Carousel = function ($) {
781
808
  return activeElement;
782
809
  }
783
810
 
784
- var delta = direction === Direction.PREVIOUS ? -1 : 1;
811
+ var delta = direction === Direction.PREV ? -1 : 1;
785
812
  var itemIndex = (activeIndex + delta) % this._items.length;
786
813
 
787
814
  return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
788
815
  };
789
816
 
790
817
  Carousel.prototype._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
818
+ var targetIndex = this._getItemIndex(relatedTarget);
819
+ var fromIndex = this._getItemIndex($(this._element).find(Selector.ACTIVE_ITEM)[0]);
791
820
  var slideEvent = $.Event(Event.SLIDE, {
792
821
  relatedTarget: relatedTarget,
793
- direction: eventDirectionName
822
+ direction: eventDirectionName,
823
+ from: fromIndex,
824
+ to: targetIndex
794
825
  });
795
826
 
796
827
  $(this._element).trigger(slideEvent);
@@ -814,8 +845,9 @@ var Carousel = function ($) {
814
845
  var _this5 = this;
815
846
 
816
847
  var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
848
+ var activeElementIndex = this._getItemIndex(activeElement);
817
849
  var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
818
-
850
+ var nextElementIndex = this._getItemIndex(nextElement);
819
851
  var isCycling = Boolean(this._interval);
820
852
 
821
853
  var directionalClassName = void 0;
@@ -857,7 +889,9 @@ var Carousel = function ($) {
857
889
 
858
890
  var slidEvent = $.Event(Event.SLID, {
859
891
  relatedTarget: nextElement,
860
- direction: eventDirectionName
892
+ direction: eventDirectionName,
893
+ from: activeElementIndex,
894
+ to: nextElementIndex
861
895
  });
862
896
 
863
897
  if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) {
@@ -1002,7 +1036,7 @@ var Carousel = function ($) {
1002
1036
 
1003
1037
  /**
1004
1038
  * --------------------------------------------------------------------------
1005
- * Bootstrap (v4.0.0-alpha.6): collapse.js
1039
+ * Bootstrap (v4.0.0-beta): collapse.js
1006
1040
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1007
1041
  * --------------------------------------------------------------------------
1008
1042
  */
@@ -1016,7 +1050,7 @@ var Collapse = function ($) {
1016
1050
  */
1017
1051
 
1018
1052
  var NAME = 'collapse';
1019
- var VERSION = '4.0.0-alpha.6';
1053
+ var VERSION = '4.0.0-beta';
1020
1054
  var DATA_KEY = 'bs.collapse';
1021
1055
  var EVENT_KEY = '.' + DATA_KEY;
1022
1056
  var DATA_API_KEY = '.data-api';
@@ -1054,16 +1088,16 @@ var Collapse = function ($) {
1054
1088
  };
1055
1089
 
1056
1090
  var Selector = {
1057
- ACTIVES: '.card > .show, .card > .collapsing',
1091
+ ACTIVES: '.show, .collapsing',
1058
1092
  DATA_TOGGLE: '[data-toggle="collapse"]'
1059
- };
1060
1093
 
1061
- /**
1062
- * ------------------------------------------------------------------------
1063
- * Class Definition
1064
- * ------------------------------------------------------------------------
1065
- */
1094
+ /**
1095
+ * ------------------------------------------------------------------------
1096
+ * Class Definition
1097
+ * ------------------------------------------------------------------------
1098
+ */
1066
1099
 
1100
+ };
1067
1101
  var Collapse = function () {
1068
1102
  function Collapse(element, config) {
1069
1103
  _classCallCheck(this, Collapse);
@@ -1072,6 +1106,14 @@ var Collapse = function ($) {
1072
1106
  this._element = element;
1073
1107
  this._config = this._getConfig(config);
1074
1108
  this._triggerArray = $.makeArray($('[data-toggle="collapse"][href="#' + element.id + '"],' + ('[data-toggle="collapse"][data-target="#' + element.id + '"]')));
1109
+ var tabToggles = $(Selector.DATA_TOGGLE);
1110
+ for (var i = 0; i < tabToggles.length; i++) {
1111
+ var elem = tabToggles[i];
1112
+ var selector = Util.getSelectorFromElement(elem);
1113
+ if (selector !== null && $(selector).filter(element).length > 0) {
1114
+ this._triggerArray.push(elem);
1115
+ }
1116
+ }
1075
1117
 
1076
1118
  this._parent = this._config.parent ? this._getParent() : null;
1077
1119
 
@@ -1099,11 +1141,7 @@ var Collapse = function ($) {
1099
1141
  Collapse.prototype.show = function show() {
1100
1142
  var _this6 = this;
1101
1143
 
1102
- if (this._isTransitioning) {
1103
- throw new Error('Collapse is transitioning');
1104
- }
1105
-
1106
- if ($(this._element).hasClass(ClassName.SHOW)) {
1144
+ if (this._isTransitioning || $(this._element).hasClass(ClassName.SHOW)) {
1107
1145
  return;
1108
1146
  }
1109
1147
 
@@ -1111,7 +1149,7 @@ var Collapse = function ($) {
1111
1149
  var activesData = void 0;
1112
1150
 
1113
1151
  if (this._parent) {
1114
- actives = $.makeArray($(this._parent).find(Selector.ACTIVES));
1152
+ actives = $.makeArray($(this._parent).children().children(Selector.ACTIVES));
1115
1153
  if (!actives.length) {
1116
1154
  actives = null;
1117
1155
  }
@@ -1142,7 +1180,6 @@ var Collapse = function ($) {
1142
1180
  $(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
1143
1181
 
1144
1182
  this._element.style[dimension] = 0;
1145
- this._element.setAttribute('aria-expanded', true);
1146
1183
 
1147
1184
  if (this._triggerArray.length) {
1148
1185
  $(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
@@ -1176,11 +1213,7 @@ var Collapse = function ($) {
1176
1213
  Collapse.prototype.hide = function hide() {
1177
1214
  var _this7 = this;
1178
1215
 
1179
- if (this._isTransitioning) {
1180
- throw new Error('Collapse is transitioning');
1181
- }
1182
-
1183
- if (!$(this._element).hasClass(ClassName.SHOW)) {
1216
+ if (this._isTransitioning || !$(this._element).hasClass(ClassName.SHOW)) {
1184
1217
  return;
1185
1218
  }
1186
1219
 
@@ -1191,18 +1224,24 @@ var Collapse = function ($) {
1191
1224
  }
1192
1225
 
1193
1226
  var dimension = this._getDimension();
1194
- var offsetDimension = dimension === Dimension.WIDTH ? 'offsetWidth' : 'offsetHeight';
1195
1227
 
1196
- this._element.style[dimension] = this._element[offsetDimension] + 'px';
1228
+ this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + 'px';
1197
1229
 
1198
1230
  Util.reflow(this._element);
1199
1231
 
1200
1232
  $(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
1201
1233
 
1202
- this._element.setAttribute('aria-expanded', false);
1203
-
1204
1234
  if (this._triggerArray.length) {
1205
- $(this._triggerArray).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
1235
+ for (var i = 0; i < this._triggerArray.length; i++) {
1236
+ var trigger = this._triggerArray[i];
1237
+ var selector = Util.getSelectorFromElement(trigger);
1238
+ if (selector !== null) {
1239
+ var $elem = $(selector);
1240
+ if (!$elem.hasClass(ClassName.SHOW)) {
1241
+ $(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
1242
+ }
1243
+ }
1244
+ }
1206
1245
  }
1207
1246
 
1208
1247
  this.setTransitioning(true);
@@ -1266,7 +1305,6 @@ var Collapse = function ($) {
1266
1305
  Collapse.prototype._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
1267
1306
  if (element) {
1268
1307
  var isOpen = $(element).hasClass(ClassName.SHOW);
1269
- element.setAttribute('aria-expanded', isOpen);
1270
1308
 
1271
1309
  if (triggerArray.length) {
1272
1310
  $(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
@@ -1327,13 +1365,18 @@ var Collapse = function ($) {
1327
1365
  */
1328
1366
 
1329
1367
  $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
1330
- event.preventDefault();
1331
-
1332
- var target = Collapse._getTargetFromElement(this);
1333
- var data = $(target).data(DATA_KEY);
1334
- var config = data ? 'toggle' : $(this).data();
1368
+ if (!/input|textarea/i.test(event.target.tagName)) {
1369
+ event.preventDefault();
1370
+ }
1335
1371
 
1336
- Collapse._jQueryInterface.call($(target), config);
1372
+ var $trigger = $(this);
1373
+ var selector = Util.getSelectorFromElement(this);
1374
+ $(selector).each(function () {
1375
+ var $target = $(this);
1376
+ var data = $target.data(DATA_KEY);
1377
+ var config = data ? 'toggle' : $trigger.data();
1378
+ Collapse._jQueryInterface.call($target, config);
1379
+ });
1337
1380
  });
1338
1381
 
1339
1382
  /**
@@ -1352,15 +1395,25 @@ var Collapse = function ($) {
1352
1395
  return Collapse;
1353
1396
  }(jQuery);
1354
1397
 
1398
+ /* global Popper */
1399
+
1355
1400
  /**
1356
1401
  * --------------------------------------------------------------------------
1357
- * Bootstrap (v4.0.0-alpha.6): dropdown.js
1402
+ * Bootstrap (v4.0.0-beta): dropdown.js
1358
1403
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1359
1404
  * --------------------------------------------------------------------------
1360
1405
  */
1361
1406
 
1362
1407
  var Dropdown = function ($) {
1363
1408
 
1409
+ /**
1410
+ * Check for Popper dependency
1411
+ * Popper - https://popper.js.org
1412
+ */
1413
+ if (typeof Popper === 'undefined') {
1414
+ throw new Error('Bootstrap dropdown require Popper.js (https://popper.js.org)');
1415
+ }
1416
+
1364
1417
  /**
1365
1418
  * ------------------------------------------------------------------------
1366
1419
  * Constants
@@ -1368,15 +1421,18 @@ var Dropdown = function ($) {
1368
1421
  */
1369
1422
 
1370
1423
  var NAME = 'dropdown';
1371
- var VERSION = '4.0.0-alpha.6';
1424
+ var VERSION = '4.0.0-beta';
1372
1425
  var DATA_KEY = 'bs.dropdown';
1373
1426
  var EVENT_KEY = '.' + DATA_KEY;
1374
1427
  var DATA_API_KEY = '.data-api';
1375
1428
  var JQUERY_NO_CONFLICT = $.fn[NAME];
1376
1429
  var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
1430
+ var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
1431
+ var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
1377
1432
  var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
1378
1433
  var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
1379
1434
  var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
1435
+ var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + '|' + ARROW_DOWN_KEYCODE + '|' + ESCAPE_KEYCODE);
1380
1436
 
1381
1437
  var Event = {
1382
1438
  HIDE: 'hide' + EVENT_KEY,
@@ -1385,37 +1441,60 @@ var Dropdown = function ($) {
1385
1441
  SHOWN: 'shown' + EVENT_KEY,
1386
1442
  CLICK: 'click' + EVENT_KEY,
1387
1443
  CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
1388
- FOCUSIN_DATA_API: 'focusin' + EVENT_KEY + DATA_API_KEY,
1389
- KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY
1444
+ KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY,
1445
+ KEYUP_DATA_API: 'keyup' + EVENT_KEY + DATA_API_KEY
1390
1446
  };
1391
1447
 
1392
1448
  var ClassName = {
1393
- BACKDROP: 'dropdown-backdrop',
1394
1449
  DISABLED: 'disabled',
1395
- SHOW: 'show'
1450
+ SHOW: 'show',
1451
+ DROPUP: 'dropup',
1452
+ MENURIGHT: 'dropdown-menu-right',
1453
+ MENULEFT: 'dropdown-menu-left'
1396
1454
  };
1397
1455
 
1398
1456
  var Selector = {
1399
- BACKDROP: '.dropdown-backdrop',
1400
1457
  DATA_TOGGLE: '[data-toggle="dropdown"]',
1401
1458
  FORM_CHILD: '.dropdown form',
1402
- ROLE_MENU: '[role="menu"]',
1403
- ROLE_LISTBOX: '[role="listbox"]',
1459
+ MENU: '.dropdown-menu',
1404
1460
  NAVBAR_NAV: '.navbar-nav',
1405
- VISIBLE_ITEMS: '[role="menu"] li:not(.disabled) a, ' + '[role="listbox"] li:not(.disabled) a'
1461
+ VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled)'
1406
1462
  };
1407
1463
 
1408
- /**
1409
- * ------------------------------------------------------------------------
1410
- * Class Definition
1411
- * ------------------------------------------------------------------------
1412
- */
1464
+ var AttachmentMap = {
1465
+ TOP: 'top-start',
1466
+ TOPEND: 'top-end',
1467
+ BOTTOM: 'bottom-start',
1468
+ BOTTOMEND: 'bottom-end'
1469
+ };
1470
+
1471
+ var Default = {
1472
+ placement: AttachmentMap.BOTTOM,
1473
+ offset: 0,
1474
+ flip: true
1475
+ };
1476
+
1477
+ var DefaultType = {
1478
+ placement: 'string',
1479
+ offset: '(number|string)',
1480
+ flip: 'boolean'
1413
1481
 
1482
+ /**
1483
+ * ------------------------------------------------------------------------
1484
+ * Class Definition
1485
+ * ------------------------------------------------------------------------
1486
+ */
1487
+
1488
+ };
1414
1489
  var Dropdown = function () {
1415
- function Dropdown(element) {
1490
+ function Dropdown(element, config) {
1416
1491
  _classCallCheck(this, Dropdown);
1417
1492
 
1418
1493
  this._element = element;
1494
+ this._popper = null;
1495
+ this._config = this._getConfig(config);
1496
+ this._menu = this._getMenuElement();
1497
+ this._inNavbar = this._detectNavbar();
1419
1498
 
1420
1499
  this._addEventListeners();
1421
1500
  }
@@ -1425,58 +1504,144 @@ var Dropdown = function ($) {
1425
1504
  // public
1426
1505
 
1427
1506
  Dropdown.prototype.toggle = function toggle() {
1428
- if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
1429
- return false;
1507
+ if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED)) {
1508
+ return;
1430
1509
  }
1431
1510
 
1432
- var parent = Dropdown._getParentFromElement(this);
1433
- var isActive = $(parent).hasClass(ClassName.SHOW);
1511
+ var parent = Dropdown._getParentFromElement(this._element);
1512
+ var isActive = $(this._menu).hasClass(ClassName.SHOW);
1434
1513
 
1435
1514
  Dropdown._clearMenus();
1436
1515
 
1437
1516
  if (isActive) {
1438
- return false;
1439
- }
1440
-
1441
- if ('ontouchstart' in document.documentElement && !$(parent).closest(Selector.NAVBAR_NAV).length) {
1442
-
1443
- // if mobile we use a backdrop because click events don't delegate
1444
- var dropdown = document.createElement('div');
1445
- dropdown.className = ClassName.BACKDROP;
1446
- $(dropdown).insertBefore(this);
1447
- $(dropdown).on('click', Dropdown._clearMenus);
1517
+ return;
1448
1518
  }
1449
1519
 
1450
1520
  var relatedTarget = {
1451
- relatedTarget: this
1521
+ relatedTarget: this._element
1452
1522
  };
1453
1523
  var showEvent = $.Event(Event.SHOW, relatedTarget);
1454
1524
 
1455
1525
  $(parent).trigger(showEvent);
1456
1526
 
1457
1527
  if (showEvent.isDefaultPrevented()) {
1458
- return false;
1528
+ return;
1459
1529
  }
1460
1530
 
1461
- this.focus();
1462
- this.setAttribute('aria-expanded', true);
1531
+ var element = this._element;
1532
+ // for dropup with alignment we use the parent as popper container
1533
+ if ($(parent).hasClass(ClassName.DROPUP)) {
1534
+ if ($(this._menu).hasClass(ClassName.MENULEFT) || $(this._menu).hasClass(ClassName.MENURIGHT)) {
1535
+ element = parent;
1536
+ }
1537
+ }
1538
+ this._popper = new Popper(element, this._menu, this._getPopperConfig());
1539
+
1540
+ // if this is a touch-enabled device we add extra
1541
+ // empty mouseover listeners to the body's immediate children;
1542
+ // only needed because of broken event delegation on iOS
1543
+ // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
1544
+ if ('ontouchstart' in document.documentElement && !$(parent).closest(Selector.NAVBAR_NAV).length) {
1545
+ $('body').children().on('mouseover', null, $.noop);
1546
+ }
1463
1547
 
1464
- $(parent).toggleClass(ClassName.SHOW);
1465
- $(parent).trigger($.Event(Event.SHOWN, relatedTarget));
1548
+ this._element.focus();
1549
+ this._element.setAttribute('aria-expanded', true);
1466
1550
 
1467
- return false;
1551
+ $(this._menu).toggleClass(ClassName.SHOW);
1552
+ $(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.SHOWN, relatedTarget));
1468
1553
  };
1469
1554
 
1470
1555
  Dropdown.prototype.dispose = function dispose() {
1471
1556
  $.removeData(this._element, DATA_KEY);
1472
1557
  $(this._element).off(EVENT_KEY);
1473
1558
  this._element = null;
1559
+ this._menu = null;
1560
+ if (this._popper !== null) {
1561
+ this._popper.destroy();
1562
+ }
1563
+ this._popper = null;
1564
+ };
1565
+
1566
+ Dropdown.prototype.update = function update() {
1567
+ this._inNavbar = this._detectNavbar();
1568
+ if (this._popper !== null) {
1569
+ this._popper.scheduleUpdate();
1570
+ }
1474
1571
  };
1475
1572
 
1476
1573
  // private
1477
1574
 
1478
1575
  Dropdown.prototype._addEventListeners = function _addEventListeners() {
1479
- $(this._element).on(Event.CLICK, this.toggle);
1576
+ var _this9 = this;
1577
+
1578
+ $(this._element).on(Event.CLICK, function (event) {
1579
+ event.preventDefault();
1580
+ event.stopPropagation();
1581
+ _this9.toggle();
1582
+ });
1583
+ };
1584
+
1585
+ Dropdown.prototype._getConfig = function _getConfig(config) {
1586
+ var elementData = $(this._element).data();
1587
+ if (elementData.placement !== undefined) {
1588
+ elementData.placement = AttachmentMap[elementData.placement.toUpperCase()];
1589
+ }
1590
+
1591
+ config = $.extend({}, this.constructor.Default, $(this._element).data(), config);
1592
+
1593
+ Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
1594
+
1595
+ return config;
1596
+ };
1597
+
1598
+ Dropdown.prototype._getMenuElement = function _getMenuElement() {
1599
+ if (!this._menu) {
1600
+ var parent = Dropdown._getParentFromElement(this._element);
1601
+ this._menu = $(parent).find(Selector.MENU)[0];
1602
+ }
1603
+ return this._menu;
1604
+ };
1605
+
1606
+ Dropdown.prototype._getPlacement = function _getPlacement() {
1607
+ var $parentDropdown = $(this._element).parent();
1608
+ var placement = this._config.placement;
1609
+
1610
+ // Handle dropup
1611
+ if ($parentDropdown.hasClass(ClassName.DROPUP) || this._config.placement === AttachmentMap.TOP) {
1612
+ placement = AttachmentMap.TOP;
1613
+ if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
1614
+ placement = AttachmentMap.TOPEND;
1615
+ }
1616
+ } else if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
1617
+ placement = AttachmentMap.BOTTOMEND;
1618
+ }
1619
+ return placement;
1620
+ };
1621
+
1622
+ Dropdown.prototype._detectNavbar = function _detectNavbar() {
1623
+ return $(this._element).closest('.navbar').length > 0;
1624
+ };
1625
+
1626
+ Dropdown.prototype._getPopperConfig = function _getPopperConfig() {
1627
+ var popperConfig = {
1628
+ placement: this._getPlacement(),
1629
+ modifiers: {
1630
+ offset: {
1631
+ offset: this._config.offset
1632
+ },
1633
+ flip: {
1634
+ enabled: this._config.flip
1635
+ }
1636
+ }
1637
+
1638
+ // Disable Popper.js for Dropdown in Navbar
1639
+ };if (this._inNavbar) {
1640
+ popperConfig.modifiers.applyStyle = {
1641
+ enabled: !this._inNavbar
1642
+ };
1643
+ }
1644
+ return popperConfig;
1480
1645
  };
1481
1646
 
1482
1647
  // static
@@ -1484,9 +1649,10 @@ var Dropdown = function ($) {
1484
1649
  Dropdown._jQueryInterface = function _jQueryInterface(config) {
1485
1650
  return this.each(function () {
1486
1651
  var data = $(this).data(DATA_KEY);
1652
+ var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
1487
1653
 
1488
1654
  if (!data) {
1489
- data = new Dropdown(this);
1655
+ data = new Dropdown(this, _config);
1490
1656
  $(this).data(DATA_KEY, data);
1491
1657
  }
1492
1658
 
@@ -1494,34 +1660,34 @@ var Dropdown = function ($) {
1494
1660
  if (data[config] === undefined) {
1495
1661
  throw new Error('No method named "' + config + '"');
1496
1662
  }
1497
- data[config].call(this);
1663
+ data[config]();
1498
1664
  }
1499
1665
  });
1500
1666
  };
1501
1667
 
1502
1668
  Dropdown._clearMenus = function _clearMenus(event) {
1503
- if (event && event.which === RIGHT_MOUSE_BUTTON_WHICH) {
1669
+ if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
1504
1670
  return;
1505
1671
  }
1506
1672
 
1507
- var backdrop = $(Selector.BACKDROP)[0];
1508
- if (backdrop) {
1509
- backdrop.parentNode.removeChild(backdrop);
1510
- }
1511
-
1512
1673
  var toggles = $.makeArray($(Selector.DATA_TOGGLE));
1513
-
1514
1674
  for (var i = 0; i < toggles.length; i++) {
1515
1675
  var parent = Dropdown._getParentFromElement(toggles[i]);
1676
+ var context = $(toggles[i]).data(DATA_KEY);
1516
1677
  var relatedTarget = {
1517
1678
  relatedTarget: toggles[i]
1518
1679
  };
1519
1680
 
1681
+ if (!context) {
1682
+ continue;
1683
+ }
1684
+
1685
+ var dropdownMenu = context._menu;
1520
1686
  if (!$(parent).hasClass(ClassName.SHOW)) {
1521
1687
  continue;
1522
1688
  }
1523
1689
 
1524
- if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'focusin') && $.contains(parent, event.target)) {
1690
+ if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
1525
1691
  continue;
1526
1692
  }
1527
1693
 
@@ -1531,8 +1697,15 @@ var Dropdown = function ($) {
1531
1697
  continue;
1532
1698
  }
1533
1699
 
1700
+ // if this is a touch-enabled device we remove the extra
1701
+ // empty mouseover listeners we added for iOS support
1702
+ if ('ontouchstart' in document.documentElement) {
1703
+ $('body').children().off('mouseover', null, $.noop);
1704
+ }
1705
+
1534
1706
  toggles[i].setAttribute('aria-expanded', 'false');
1535
1707
 
1708
+ $(dropdownMenu).removeClass(ClassName.SHOW);
1536
1709
  $(parent).removeClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget));
1537
1710
  }
1538
1711
  };
@@ -1549,7 +1722,7 @@ var Dropdown = function ($) {
1549
1722
  };
1550
1723
 
1551
1724
  Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
1552
- if (!/(38|40|27|32)/.test(event.which) || /input|textarea/i.test(event.target.tagName)) {
1725
+ if (!REGEXP_KEYDOWN.test(event.which) || /button/i.test(event.target.tagName) && event.which === SPACE_KEYCODE || /input|textarea/i.test(event.target.tagName)) {
1553
1726
  return;
1554
1727
  }
1555
1728
 
@@ -1563,7 +1736,7 @@ var Dropdown = function ($) {
1563
1736
  var parent = Dropdown._getParentFromElement(this);
1564
1737
  var isActive = $(parent).hasClass(ClassName.SHOW);
1565
1738
 
1566
- if (!isActive && event.which !== ESCAPE_KEYCODE || isActive && event.which === ESCAPE_KEYCODE) {
1739
+ if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
1567
1740
 
1568
1741
  if (event.which === ESCAPE_KEYCODE) {
1569
1742
  var toggle = $(parent).find(Selector.DATA_TOGGLE)[0];
@@ -1604,6 +1777,16 @@ var Dropdown = function ($) {
1604
1777
  get: function get() {
1605
1778
  return VERSION;
1606
1779
  }
1780
+ }, {
1781
+ key: 'Default',
1782
+ get: function get() {
1783
+ return Default;
1784
+ }
1785
+ }, {
1786
+ key: 'DefaultType',
1787
+ get: function get() {
1788
+ return DefaultType;
1789
+ }
1607
1790
  }]);
1608
1791
 
1609
1792
  return Dropdown;
@@ -1615,7 +1798,11 @@ var Dropdown = function ($) {
1615
1798
  * ------------------------------------------------------------------------
1616
1799
  */
1617
1800
 
1618
- $(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API + ' ' + Event.FOCUSIN_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
1801
+ $(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API + ' ' + Event.KEYUP_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
1802
+ event.preventDefault();
1803
+ event.stopPropagation();
1804
+ Dropdown._jQueryInterface.call($(this), 'toggle');
1805
+ }).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
1619
1806
  e.stopPropagation();
1620
1807
  });
1621
1808
 
@@ -1637,7 +1824,7 @@ var Dropdown = function ($) {
1637
1824
 
1638
1825
  /**
1639
1826
  * --------------------------------------------------------------------------
1640
- * Bootstrap (v4.0.0-alpha.6): modal.js
1827
+ * Bootstrap (v4.0.0-beta): modal.js
1641
1828
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1642
1829
  * --------------------------------------------------------------------------
1643
1830
  */
@@ -1651,7 +1838,7 @@ var Modal = function ($) {
1651
1838
  */
1652
1839
 
1653
1840
  var NAME = 'modal';
1654
- var VERSION = '4.0.0-alpha.6';
1841
+ var VERSION = '4.0.0-beta';
1655
1842
  var DATA_KEY = 'bs.modal';
1656
1843
  var EVENT_KEY = '.' + DATA_KEY;
1657
1844
  var DATA_API_KEY = '.data-api';
@@ -1700,15 +1887,16 @@ var Modal = function ($) {
1700
1887
  DIALOG: '.modal-dialog',
1701
1888
  DATA_TOGGLE: '[data-toggle="modal"]',
1702
1889
  DATA_DISMISS: '[data-dismiss="modal"]',
1703
- FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'
1704
- };
1890
+ FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
1891
+ NAVBAR_TOGGLER: '.navbar-toggler'
1705
1892
 
1706
- /**
1707
- * ------------------------------------------------------------------------
1708
- * Class Definition
1709
- * ------------------------------------------------------------------------
1710
- */
1893
+ /**
1894
+ * ------------------------------------------------------------------------
1895
+ * Class Definition
1896
+ * ------------------------------------------------------------------------
1897
+ */
1711
1898
 
1899
+ };
1712
1900
  var Modal = function () {
1713
1901
  function Modal(element, config) {
1714
1902
  _classCallCheck(this, Modal);
@@ -1720,7 +1908,6 @@ var Modal = function ($) {
1720
1908
  this._isShown = false;
1721
1909
  this._isBodyOverflowing = false;
1722
1910
  this._ignoreBackdropClick = false;
1723
- this._isTransitioning = false;
1724
1911
  this._originalBodyPadding = 0;
1725
1912
  this._scrollbarWidth = 0;
1726
1913
  }
@@ -1734,15 +1921,16 @@ var Modal = function ($) {
1734
1921
  };
1735
1922
 
1736
1923
  Modal.prototype.show = function show(relatedTarget) {
1737
- var _this9 = this;
1924
+ var _this10 = this;
1738
1925
 
1739
1926
  if (this._isTransitioning) {
1740
- throw new Error('Modal is transitioning');
1927
+ return;
1741
1928
  }
1742
1929
 
1743
1930
  if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
1744
1931
  this._isTransitioning = true;
1745
1932
  }
1933
+
1746
1934
  var showEvent = $.Event(Event.SHOW, {
1747
1935
  relatedTarget: relatedTarget
1748
1936
  });
@@ -1764,39 +1952,41 @@ var Modal = function ($) {
1764
1952
  this._setResizeEvent();
1765
1953
 
1766
1954
  $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
1767
- return _this9.hide(event);
1955
+ return _this10.hide(event);
1768
1956
  });
1769
1957
 
1770
1958
  $(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
1771
- $(_this9._element).one(Event.MOUSEUP_DISMISS, function (event) {
1772
- if ($(event.target).is(_this9._element)) {
1773
- _this9._ignoreBackdropClick = true;
1959
+ $(_this10._element).one(Event.MOUSEUP_DISMISS, function (event) {
1960
+ if ($(event.target).is(_this10._element)) {
1961
+ _this10._ignoreBackdropClick = true;
1774
1962
  }
1775
1963
  });
1776
1964
  });
1777
1965
 
1778
1966
  this._showBackdrop(function () {
1779
- return _this9._showElement(relatedTarget);
1967
+ return _this10._showElement(relatedTarget);
1780
1968
  });
1781
1969
  };
1782
1970
 
1783
1971
  Modal.prototype.hide = function hide(event) {
1784
- var _this10 = this;
1972
+ var _this11 = this;
1785
1973
 
1786
1974
  if (event) {
1787
1975
  event.preventDefault();
1788
1976
  }
1789
1977
 
1790
- if (this._isTransitioning) {
1791
- throw new Error('Modal is transitioning');
1978
+ if (this._isTransitioning || !this._isShown) {
1979
+ return;
1792
1980
  }
1793
1981
 
1794
1982
  var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
1983
+
1795
1984
  if (transition) {
1796
1985
  this._isTransitioning = true;
1797
1986
  }
1798
1987
 
1799
1988
  var hideEvent = $.Event(Event.HIDE);
1989
+
1800
1990
  $(this._element).trigger(hideEvent);
1801
1991
 
1802
1992
  if (!this._isShown || hideEvent.isDefaultPrevented()) {
@@ -1816,8 +2006,9 @@ var Modal = function ($) {
1816
2006
  $(this._dialog).off(Event.MOUSEDOWN_DISMISS);
1817
2007
 
1818
2008
  if (transition) {
2009
+
1819
2010
  $(this._element).one(Util.TRANSITION_END, function (event) {
1820
- return _this10._hideModal(event);
2011
+ return _this11._hideModal(event);
1821
2012
  }).emulateTransitionEnd(TRANSITION_DURATION);
1822
2013
  } else {
1823
2014
  this._hideModal();
@@ -1836,10 +2027,13 @@ var Modal = function ($) {
1836
2027
  this._isShown = null;
1837
2028
  this._isBodyOverflowing = null;
1838
2029
  this._ignoreBackdropClick = null;
1839
- this._originalBodyPadding = null;
1840
2030
  this._scrollbarWidth = null;
1841
2031
  };
1842
2032
 
2033
+ Modal.prototype.handleUpdate = function handleUpdate() {
2034
+ this._adjustDialog();
2035
+ };
2036
+
1843
2037
  // private
1844
2038
 
1845
2039
  Modal.prototype._getConfig = function _getConfig(config) {
@@ -1849,7 +2043,7 @@ var Modal = function ($) {
1849
2043
  };
1850
2044
 
1851
2045
  Modal.prototype._showElement = function _showElement(relatedTarget) {
1852
- var _this11 = this;
2046
+ var _this12 = this;
1853
2047
 
1854
2048
  var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
1855
2049
 
@@ -1877,11 +2071,11 @@ var Modal = function ($) {
1877
2071
  });
1878
2072
 
1879
2073
  var transitionComplete = function transitionComplete() {
1880
- if (_this11._config.focus) {
1881
- _this11._element.focus();
2074
+ if (_this12._config.focus) {
2075
+ _this12._element.focus();
1882
2076
  }
1883
- _this11._isTransitioning = false;
1884
- $(_this11._element).trigger(shownEvent);
2077
+ _this12._isTransitioning = false;
2078
+ $(_this12._element).trigger(shownEvent);
1885
2079
  };
1886
2080
 
1887
2081
  if (transition) {
@@ -1892,23 +2086,24 @@ var Modal = function ($) {
1892
2086
  };
1893
2087
 
1894
2088
  Modal.prototype._enforceFocus = function _enforceFocus() {
1895
- var _this12 = this;
2089
+ var _this13 = this;
1896
2090
 
1897
2091
  $(document).off(Event.FOCUSIN) // guard against infinite focus loop
1898
2092
  .on(Event.FOCUSIN, function (event) {
1899
- if (document !== event.target && _this12._element !== event.target && !$(_this12._element).has(event.target).length) {
1900
- _this12._element.focus();
2093
+ if (document !== event.target && _this13._element !== event.target && !$(_this13._element).has(event.target).length) {
2094
+ _this13._element.focus();
1901
2095
  }
1902
2096
  });
1903
2097
  };
1904
2098
 
1905
2099
  Modal.prototype._setEscapeEvent = function _setEscapeEvent() {
1906
- var _this13 = this;
2100
+ var _this14 = this;
1907
2101
 
1908
2102
  if (this._isShown && this._config.keyboard) {
1909
2103
  $(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
1910
2104
  if (event.which === ESCAPE_KEYCODE) {
1911
- _this13.hide();
2105
+ event.preventDefault();
2106
+ _this14.hide();
1912
2107
  }
1913
2108
  });
1914
2109
  } else if (!this._isShown) {
@@ -1917,11 +2112,11 @@ var Modal = function ($) {
1917
2112
  };
1918
2113
 
1919
2114
  Modal.prototype._setResizeEvent = function _setResizeEvent() {
1920
- var _this14 = this;
2115
+ var _this15 = this;
1921
2116
 
1922
2117
  if (this._isShown) {
1923
2118
  $(window).on(Event.RESIZE, function (event) {
1924
- return _this14._handleUpdate(event);
2119
+ return _this15.handleUpdate(event);
1925
2120
  });
1926
2121
  } else {
1927
2122
  $(window).off(Event.RESIZE);
@@ -1929,16 +2124,16 @@ var Modal = function ($) {
1929
2124
  };
1930
2125
 
1931
2126
  Modal.prototype._hideModal = function _hideModal() {
1932
- var _this15 = this;
2127
+ var _this16 = this;
1933
2128
 
1934
2129
  this._element.style.display = 'none';
1935
- this._element.setAttribute('aria-hidden', 'true');
2130
+ this._element.setAttribute('aria-hidden', true);
1936
2131
  this._isTransitioning = false;
1937
2132
  this._showBackdrop(function () {
1938
2133
  $(document.body).removeClass(ClassName.OPEN);
1939
- _this15._resetAdjustments();
1940
- _this15._resetScrollbar();
1941
- $(_this15._element).trigger(Event.HIDDEN);
2134
+ _this16._resetAdjustments();
2135
+ _this16._resetScrollbar();
2136
+ $(_this16._element).trigger(Event.HIDDEN);
1942
2137
  });
1943
2138
  };
1944
2139
 
@@ -1950,7 +2145,7 @@ var Modal = function ($) {
1950
2145
  };
1951
2146
 
1952
2147
  Modal.prototype._showBackdrop = function _showBackdrop(callback) {
1953
- var _this16 = this;
2148
+ var _this17 = this;
1954
2149
 
1955
2150
  var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
1956
2151
 
@@ -1967,17 +2162,17 @@ var Modal = function ($) {
1967
2162
  $(this._backdrop).appendTo(document.body);
1968
2163
 
1969
2164
  $(this._element).on(Event.CLICK_DISMISS, function (event) {
1970
- if (_this16._ignoreBackdropClick) {
1971
- _this16._ignoreBackdropClick = false;
2165
+ if (_this17._ignoreBackdropClick) {
2166
+ _this17._ignoreBackdropClick = false;
1972
2167
  return;
1973
2168
  }
1974
2169
  if (event.target !== event.currentTarget) {
1975
2170
  return;
1976
2171
  }
1977
- if (_this16._config.backdrop === 'static') {
1978
- _this16._element.focus();
2172
+ if (_this17._config.backdrop === 'static') {
2173
+ _this17._element.focus();
1979
2174
  } else {
1980
- _this16.hide();
2175
+ _this17.hide();
1981
2176
  }
1982
2177
  });
1983
2178
 
@@ -2001,7 +2196,7 @@ var Modal = function ($) {
2001
2196
  $(this._backdrop).removeClass(ClassName.SHOW);
2002
2197
 
2003
2198
  var callbackRemove = function callbackRemove() {
2004
- _this16._removeBackdrop();
2199
+ _this17._removeBackdrop();
2005
2200
  if (callback) {
2006
2201
  callback();
2007
2202
  }
@@ -2022,10 +2217,6 @@ var Modal = function ($) {
2022
2217
  // todo (fat): these should probably be refactored out of modal.js
2023
2218
  // ----------------------------------------------------------------------
2024
2219
 
2025
- Modal.prototype._handleUpdate = function _handleUpdate() {
2026
- this._adjustDialog();
2027
- };
2028
-
2029
2220
  Modal.prototype._adjustDialog = function _adjustDialog() {
2030
2221
  var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
2031
2222
 
@@ -2049,17 +2240,55 @@ var Modal = function ($) {
2049
2240
  };
2050
2241
 
2051
2242
  Modal.prototype._setScrollbar = function _setScrollbar() {
2052
- var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10);
2053
-
2054
- this._originalBodyPadding = document.body.style.paddingRight || '';
2243
+ var _this18 = this;
2055
2244
 
2056
2245
  if (this._isBodyOverflowing) {
2057
- document.body.style.paddingRight = bodyPadding + this._scrollbarWidth + 'px';
2246
+ // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
2247
+ // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
2248
+
2249
+ // Adjust fixed content padding
2250
+ $(Selector.FIXED_CONTENT).each(function (index, element) {
2251
+ var actualPadding = $(element)[0].style.paddingRight;
2252
+ var calculatedPadding = $(element).css('padding-right');
2253
+ $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this18._scrollbarWidth + 'px');
2254
+ });
2255
+
2256
+ // Adjust navbar-toggler margin
2257
+ $(Selector.NAVBAR_TOGGLER).each(function (index, element) {
2258
+ var actualMargin = $(element)[0].style.marginRight;
2259
+ var calculatedMargin = $(element).css('margin-right');
2260
+ $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this18._scrollbarWidth + 'px');
2261
+ });
2262
+
2263
+ // Adjust body padding
2264
+ var actualPadding = document.body.style.paddingRight;
2265
+ var calculatedPadding = $('body').css('padding-right');
2266
+ $('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + 'px');
2058
2267
  }
2059
2268
  };
2060
2269
 
2061
2270
  Modal.prototype._resetScrollbar = function _resetScrollbar() {
2062
- document.body.style.paddingRight = this._originalBodyPadding;
2271
+ // Restore fixed content padding
2272
+ $(Selector.FIXED_CONTENT).each(function (index, element) {
2273
+ var padding = $(element).data('padding-right');
2274
+ if (typeof padding !== 'undefined') {
2275
+ $(element).css('padding-right', padding).removeData('padding-right');
2276
+ }
2277
+ });
2278
+
2279
+ // Restore navbar-toggler margin
2280
+ $(Selector.NAVBAR_TOGGLER).each(function (index, element) {
2281
+ var margin = $(element).data('margin-right');
2282
+ if (typeof margin !== 'undefined') {
2283
+ $(element).css('margin-right', margin).removeData('margin-right');
2284
+ }
2285
+ });
2286
+
2287
+ // Restore body padding
2288
+ var padding = $('body').data('padding-right');
2289
+ if (typeof padding !== 'undefined') {
2290
+ $('body').css('padding-right', padding).removeData('padding-right');
2291
+ }
2063
2292
  };
2064
2293
 
2065
2294
  Modal.prototype._getScrollbarWidth = function _getScrollbarWidth() {
@@ -2067,7 +2296,7 @@ var Modal = function ($) {
2067
2296
  var scrollDiv = document.createElement('div');
2068
2297
  scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
2069
2298
  document.body.appendChild(scrollDiv);
2070
- var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
2299
+ var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
2071
2300
  document.body.removeChild(scrollDiv);
2072
2301
  return scrollbarWidth;
2073
2302
  };
@@ -2117,7 +2346,7 @@ var Modal = function ($) {
2117
2346
  */
2118
2347
 
2119
2348
  $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
2120
- var _this17 = this;
2349
+ var _this19 = this;
2121
2350
 
2122
2351
  var target = void 0;
2123
2352
  var selector = Util.getSelectorFromElement(this);
@@ -2139,8 +2368,8 @@ var Modal = function ($) {
2139
2368
  }
2140
2369
 
2141
2370
  $target.one(Event.HIDDEN, function () {
2142
- if ($(_this17).is(':visible')) {
2143
- _this17.focus();
2371
+ if ($(_this19).is(':visible')) {
2372
+ _this19.focus();
2144
2373
  }
2145
2374
  });
2146
2375
  });
@@ -2166,7 +2395,7 @@ var Modal = function ($) {
2166
2395
 
2167
2396
  /**
2168
2397
  * --------------------------------------------------------------------------
2169
- * Bootstrap (v4.0.0-alpha.6): scrollspy.js
2398
+ * Bootstrap (v4.0.0-beta): scrollspy.js
2170
2399
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2171
2400
  * --------------------------------------------------------------------------
2172
2401
  */
@@ -2180,7 +2409,7 @@ var ScrollSpy = function ($) {
2180
2409
  */
2181
2410
 
2182
2411
  var NAME = 'scrollspy';
2183
- var VERSION = '4.0.0-alpha.6';
2412
+ var VERSION = '4.0.0-beta';
2184
2413
  var DATA_KEY = 'bs.scrollspy';
2185
2414
  var EVENT_KEY = '.' + DATA_KEY;
2186
2415
  var DATA_API_KEY = '.data-api';
@@ -2207,18 +2436,15 @@ var ScrollSpy = function ($) {
2207
2436
  var ClassName = {
2208
2437
  DROPDOWN_ITEM: 'dropdown-item',
2209
2438
  DROPDOWN_MENU: 'dropdown-menu',
2210
- NAV_LINK: 'nav-link',
2211
- NAV: 'nav',
2212
2439
  ACTIVE: 'active'
2213
2440
  };
2214
2441
 
2215
2442
  var Selector = {
2216
2443
  DATA_SPY: '[data-spy="scroll"]',
2217
2444
  ACTIVE: '.active',
2218
- LIST_ITEM: '.list-item',
2219
- LI: 'li',
2220
- LI_DROPDOWN: 'li.dropdown',
2445
+ NAV_LIST_GROUP: '.nav, .list-group',
2221
2446
  NAV_LINKS: '.nav-link',
2447
+ LIST_ITEMS: '.list-group-item',
2222
2448
  DROPDOWN: '.dropdown',
2223
2449
  DROPDOWN_ITEMS: '.dropdown-item',
2224
2450
  DROPDOWN_TOGGLE: '.dropdown-toggle'
@@ -2227,31 +2453,31 @@ var ScrollSpy = function ($) {
2227
2453
  var OffsetMethod = {
2228
2454
  OFFSET: 'offset',
2229
2455
  POSITION: 'position'
2230
- };
2231
2456
 
2232
- /**
2233
- * ------------------------------------------------------------------------
2234
- * Class Definition
2235
- * ------------------------------------------------------------------------
2236
- */
2457
+ /**
2458
+ * ------------------------------------------------------------------------
2459
+ * Class Definition
2460
+ * ------------------------------------------------------------------------
2461
+ */
2237
2462
 
2463
+ };
2238
2464
  var ScrollSpy = function () {
2239
2465
  function ScrollSpy(element, config) {
2240
- var _this18 = this;
2466
+ var _this20 = this;
2241
2467
 
2242
2468
  _classCallCheck(this, ScrollSpy);
2243
2469
 
2244
2470
  this._element = element;
2245
2471
  this._scrollElement = element.tagName === 'BODY' ? window : element;
2246
2472
  this._config = this._getConfig(config);
2247
- this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
2473
+ this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.LIST_ITEMS + ',') + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
2248
2474
  this._offsets = [];
2249
2475
  this._targets = [];
2250
2476
  this._activeTarget = null;
2251
2477
  this._scrollHeight = 0;
2252
2478
 
2253
2479
  $(this._scrollElement).on(Event.SCROLL, function (event) {
2254
- return _this18._process(event);
2480
+ return _this20._process(event);
2255
2481
  });
2256
2482
 
2257
2483
  this.refresh();
@@ -2263,7 +2489,7 @@ var ScrollSpy = function ($) {
2263
2489
  // public
2264
2490
 
2265
2491
  ScrollSpy.prototype.refresh = function refresh() {
2266
- var _this19 = this;
2492
+ var _this21 = this;
2267
2493
 
2268
2494
  var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
2269
2495
 
@@ -2286,9 +2512,12 @@ var ScrollSpy = function ($) {
2286
2512
  target = $(targetSelector)[0];
2287
2513
  }
2288
2514
 
2289
- if (target && (target.offsetWidth || target.offsetHeight)) {
2290
- // todo (fat): remove sketch reliance on jQuery position/offset
2291
- return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
2515
+ if (target) {
2516
+ var targetBCR = target.getBoundingClientRect();
2517
+ if (targetBCR.width || targetBCR.height) {
2518
+ // todo (fat): remove sketch reliance on jQuery position/offset
2519
+ return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
2520
+ }
2292
2521
  }
2293
2522
  return null;
2294
2523
  }).filter(function (item) {
@@ -2296,8 +2525,8 @@ var ScrollSpy = function ($) {
2296
2525
  }).sort(function (a, b) {
2297
2526
  return a[0] - b[0];
2298
2527
  }).forEach(function (item) {
2299
- _this19._offsets.push(item[0]);
2300
- _this19._targets.push(item[1]);
2528
+ _this21._offsets.push(item[0]);
2529
+ _this21._targets.push(item[1]);
2301
2530
  });
2302
2531
  };
2303
2532
 
@@ -2343,7 +2572,7 @@ var ScrollSpy = function ($) {
2343
2572
  };
2344
2573
 
2345
2574
  ScrollSpy.prototype._getOffsetHeight = function _getOffsetHeight() {
2346
- return this._scrollElement === window ? window.innerHeight : this._scrollElement.offsetHeight;
2575
+ return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
2347
2576
  };
2348
2577
 
2349
2578
  ScrollSpy.prototype._process = function _process() {
@@ -2395,9 +2624,11 @@ var ScrollSpy = function ($) {
2395
2624
  $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
2396
2625
  $link.addClass(ClassName.ACTIVE);
2397
2626
  } else {
2398
- // todo (fat) this is kinda sus...
2399
- // recursively add actives to tested nav-links
2400
- $link.parents(Selector.LI).find('> ' + Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
2627
+ // Set triggered link as active
2628
+ $link.addClass(ClassName.ACTIVE);
2629
+ // Set triggered links parents as active
2630
+ // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
2631
+ $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ', ' + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE);
2401
2632
  }
2402
2633
 
2403
2634
  $(this._scrollElement).trigger(Event.ACTIVATE, {
@@ -2478,7 +2709,7 @@ var ScrollSpy = function ($) {
2478
2709
 
2479
2710
  /**
2480
2711
  * --------------------------------------------------------------------------
2481
- * Bootstrap (v4.0.0-alpha.6): tab.js
2712
+ * Bootstrap (v4.0.0-beta): tab.js
2482
2713
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2483
2714
  * --------------------------------------------------------------------------
2484
2715
  */
@@ -2492,7 +2723,7 @@ var Tab = function ($) {
2492
2723
  */
2493
2724
 
2494
2725
  var NAME = 'tab';
2495
- var VERSION = '4.0.0-alpha.6';
2726
+ var VERSION = '4.0.0-beta';
2496
2727
  var DATA_KEY = 'bs.tab';
2497
2728
  var EVENT_KEY = '.' + DATA_KEY;
2498
2729
  var DATA_API_KEY = '.data-api';
@@ -2516,24 +2747,20 @@ var Tab = function ($) {
2516
2747
  };
2517
2748
 
2518
2749
  var Selector = {
2519
- A: 'a',
2520
- LI: 'li',
2521
2750
  DROPDOWN: '.dropdown',
2522
- LIST: 'ul:not(.dropdown-menu), ol:not(.dropdown-menu), nav:not(.dropdown-menu)',
2523
- FADE_CHILD: '> .nav-item .fade, > .fade',
2751
+ NAV_LIST_GROUP: '.nav, .list-group',
2524
2752
  ACTIVE: '.active',
2525
- ACTIVE_CHILD: '> .nav-item > .active, > .active',
2526
- DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"]',
2753
+ DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
2527
2754
  DROPDOWN_TOGGLE: '.dropdown-toggle',
2528
2755
  DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
2529
- };
2530
2756
 
2531
- /**
2532
- * ------------------------------------------------------------------------
2533
- * Class Definition
2534
- * ------------------------------------------------------------------------
2535
- */
2757
+ /**
2758
+ * ------------------------------------------------------------------------
2759
+ * Class Definition
2760
+ * ------------------------------------------------------------------------
2761
+ */
2536
2762
 
2763
+ };
2537
2764
  var Tab = function () {
2538
2765
  function Tab(element) {
2539
2766
  _classCallCheck(this, Tab);
@@ -2546,7 +2773,7 @@ var Tab = function ($) {
2546
2773
  // public
2547
2774
 
2548
2775
  Tab.prototype.show = function show() {
2549
- var _this20 = this;
2776
+ var _this22 = this;
2550
2777
 
2551
2778
  if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
2552
2779
  return;
@@ -2554,7 +2781,7 @@ var Tab = function ($) {
2554
2781
 
2555
2782
  var target = void 0;
2556
2783
  var previous = void 0;
2557
- var listElement = $(this._element).closest(Selector.LIST)[0];
2784
+ var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0];
2558
2785
  var selector = Util.getSelectorFromElement(this._element);
2559
2786
 
2560
2787
  if (listElement) {
@@ -2588,7 +2815,7 @@ var Tab = function ($) {
2588
2815
 
2589
2816
  var complete = function complete() {
2590
2817
  var hiddenEvent = $.Event(Event.HIDDEN, {
2591
- relatedTarget: _this20._element
2818
+ relatedTarget: _this22._element
2592
2819
  });
2593
2820
 
2594
2821
  var shownEvent = $.Event(Event.SHOWN, {
@@ -2596,7 +2823,7 @@ var Tab = function ($) {
2596
2823
  });
2597
2824
 
2598
2825
  $(previous).trigger(hiddenEvent);
2599
- $(_this20._element).trigger(shownEvent);
2826
+ $(_this22._element).trigger(shownEvent);
2600
2827
  };
2601
2828
 
2602
2829
  if (target) {
@@ -2607,20 +2834,20 @@ var Tab = function ($) {
2607
2834
  };
2608
2835
 
2609
2836
  Tab.prototype.dispose = function dispose() {
2610
- $.removeClass(this._element, DATA_KEY);
2837
+ $.removeData(this._element, DATA_KEY);
2611
2838
  this._element = null;
2612
2839
  };
2613
2840
 
2614
2841
  // private
2615
2842
 
2616
2843
  Tab.prototype._activate = function _activate(element, container, callback) {
2617
- var _this21 = this;
2844
+ var _this23 = this;
2618
2845
 
2619
- var active = $(container).find(Selector.ACTIVE_CHILD)[0];
2620
- var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0]));
2846
+ var active = $(container).find(Selector.ACTIVE)[0];
2847
+ var isTransitioning = callback && Util.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE);
2621
2848
 
2622
2849
  var complete = function complete() {
2623
- return _this21._transitionComplete(element, active, isTransitioning, callback);
2850
+ return _this23._transitionComplete(element, active, isTransitioning, callback);
2624
2851
  };
2625
2852
 
2626
2853
  if (active && isTransitioning) {
@@ -2730,11 +2957,11 @@ var Tab = function ($) {
2730
2957
  return Tab;
2731
2958
  }(jQuery);
2732
2959
 
2733
- /* global Tether */
2960
+ /* global Popper */
2734
2961
 
2735
2962
  /**
2736
2963
  * --------------------------------------------------------------------------
2737
- * Bootstrap (v4.0.0-alpha.6): tooltip.js
2964
+ * Bootstrap (v4.0.0-beta): tooltip.js
2738
2965
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2739
2966
  * --------------------------------------------------------------------------
2740
2967
  */
@@ -2742,11 +2969,11 @@ var Tab = function ($) {
2742
2969
  var Tooltip = function ($) {
2743
2970
 
2744
2971
  /**
2745
- * Check for Tether dependency
2746
- * Tether - http://tether.io/
2972
+ * Check for Popper dependency
2973
+ * Popper - https://popper.js.org
2747
2974
  */
2748
- if (typeof Tether === 'undefined') {
2749
- throw new Error('Bootstrap tooltips require Tether (http://tether.io/)');
2975
+ if (typeof Popper === 'undefined') {
2976
+ throw new Error('Bootstrap tooltips require Popper.js (https://popper.js.org)');
2750
2977
  }
2751
2978
 
2752
2979
  /**
@@ -2756,26 +2983,13 @@ var Tooltip = function ($) {
2756
2983
  */
2757
2984
 
2758
2985
  var NAME = 'tooltip';
2759
- var VERSION = '4.0.0-alpha.6';
2986
+ var VERSION = '4.0.0-beta';
2760
2987
  var DATA_KEY = 'bs.tooltip';
2761
2988
  var EVENT_KEY = '.' + DATA_KEY;
2762
2989
  var JQUERY_NO_CONFLICT = $.fn[NAME];
2763
2990
  var TRANSITION_DURATION = 150;
2764
- var CLASS_PREFIX = 'bs-tether';
2765
-
2766
- var Default = {
2767
- animation: true,
2768
- template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-inner"></div></div>',
2769
- trigger: 'hover focus',
2770
- title: '',
2771
- delay: 0,
2772
- html: false,
2773
- selector: false,
2774
- placement: 'top',
2775
- offset: '0 0',
2776
- constraints: [],
2777
- container: false
2778
- };
2991
+ var CLASS_PREFIX = 'bs-tooltip';
2992
+ var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g');
2779
2993
 
2780
2994
  var DefaultType = {
2781
2995
  animation: 'boolean',
@@ -2786,16 +3000,31 @@ var Tooltip = function ($) {
2786
3000
  html: 'boolean',
2787
3001
  selector: '(string|boolean)',
2788
3002
  placement: '(string|function)',
2789
- offset: 'string',
2790
- constraints: 'array',
2791
- container: '(string|element|boolean)'
3003
+ offset: '(number|string)',
3004
+ container: '(string|element|boolean)',
3005
+ fallbackPlacement: '(string|array)'
2792
3006
  };
2793
3007
 
2794
3008
  var AttachmentMap = {
2795
- TOP: 'bottom center',
2796
- RIGHT: 'middle left',
2797
- BOTTOM: 'top center',
2798
- LEFT: 'middle right'
3009
+ AUTO: 'auto',
3010
+ TOP: 'top',
3011
+ RIGHT: 'right',
3012
+ BOTTOM: 'bottom',
3013
+ LEFT: 'left'
3014
+ };
3015
+
3016
+ var Default = {
3017
+ animation: true,
3018
+ template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
3019
+ trigger: 'hover focus',
3020
+ title: '',
3021
+ delay: 0,
3022
+ html: false,
3023
+ selector: false,
3024
+ placement: 'top',
3025
+ offset: 0,
3026
+ container: false,
3027
+ fallbackPlacement: 'flip'
2799
3028
  };
2800
3029
 
2801
3030
  var HoverState = {
@@ -2823,12 +3052,8 @@ var Tooltip = function ($) {
2823
3052
 
2824
3053
  var Selector = {
2825
3054
  TOOLTIP: '.tooltip',
2826
- TOOLTIP_INNER: '.tooltip-inner'
2827
- };
2828
-
2829
- var TetherClass = {
2830
- element: false,
2831
- enabled: false
3055
+ TOOLTIP_INNER: '.tooltip-inner',
3056
+ ARROW: '.arrow'
2832
3057
  };
2833
3058
 
2834
3059
  var Trigger = {
@@ -2836,14 +3061,14 @@ var Tooltip = function ($) {
2836
3061
  FOCUS: 'focus',
2837
3062
  CLICK: 'click',
2838
3063
  MANUAL: 'manual'
2839
- };
2840
3064
 
2841
- /**
2842
- * ------------------------------------------------------------------------
2843
- * Class Definition
2844
- * ------------------------------------------------------------------------
2845
- */
3065
+ /**
3066
+ * ------------------------------------------------------------------------
3067
+ * Class Definition
3068
+ * ------------------------------------------------------------------------
3069
+ */
2846
3070
 
3071
+ };
2847
3072
  var Tooltip = function () {
2848
3073
  function Tooltip(element, config) {
2849
3074
  _classCallCheck(this, Tooltip);
@@ -2853,8 +3078,7 @@ var Tooltip = function ($) {
2853
3078
  this._timeout = 0;
2854
3079
  this._hoverState = '';
2855
3080
  this._activeTrigger = {};
2856
- this._isTransitioning = false;
2857
- this._tether = null;
3081
+ this._popper = null;
2858
3082
 
2859
3083
  // protected
2860
3084
  this.element = element;
@@ -2911,8 +3135,6 @@ var Tooltip = function ($) {
2911
3135
  Tooltip.prototype.dispose = function dispose() {
2912
3136
  clearTimeout(this._timeout);
2913
3137
 
2914
- this.cleanupTether();
2915
-
2916
3138
  $.removeData(this.element, this.constructor.DATA_KEY);
2917
3139
 
2918
3140
  $(this.element).off(this.constructor.EVENT_KEY);
@@ -2926,7 +3148,10 @@ var Tooltip = function ($) {
2926
3148
  this._timeout = null;
2927
3149
  this._hoverState = null;
2928
3150
  this._activeTrigger = null;
2929
- this._tether = null;
3151
+ if (this._popper !== null) {
3152
+ this._popper.destroy();
3153
+ }
3154
+ this._popper = null;
2930
3155
 
2931
3156
  this.element = null;
2932
3157
  this.config = null;
@@ -2934,7 +3159,7 @@ var Tooltip = function ($) {
2934
3159
  };
2935
3160
 
2936
3161
  Tooltip.prototype.show = function show() {
2937
- var _this22 = this;
3162
+ var _this24 = this;
2938
3163
 
2939
3164
  if ($(this.element).css('display') === 'none') {
2940
3165
  throw new Error('Please use show on visible elements');
@@ -2942,9 +3167,6 @@ var Tooltip = function ($) {
2942
3167
 
2943
3168
  var showEvent = $.Event(this.constructor.Event.SHOW);
2944
3169
  if (this.isWithContent() && this._isEnabled) {
2945
- if (this._isTransitioning) {
2946
- throw new Error('Tooltip is transitioning');
2947
- }
2948
3170
  $(this.element).trigger(showEvent);
2949
3171
 
2950
3172
  var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
@@ -2968,68 +3190,89 @@ var Tooltip = function ($) {
2968
3190
  var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
2969
3191
 
2970
3192
  var attachment = this._getAttachment(placement);
3193
+ this.addAttachmentClass(attachment);
2971
3194
 
2972
3195
  var container = this.config.container === false ? document.body : $(this.config.container);
2973
3196
 
2974
- $(tip).data(this.constructor.DATA_KEY, this).appendTo(container);
3197
+ $(tip).data(this.constructor.DATA_KEY, this);
3198
+
3199
+ if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
3200
+ $(tip).appendTo(container);
3201
+ }
2975
3202
 
2976
3203
  $(this.element).trigger(this.constructor.Event.INSERTED);
2977
3204
 
2978
- this._tether = new Tether({
2979
- attachment: attachment,
2980
- element: tip,
2981
- target: this.element,
2982
- classes: TetherClass,
2983
- classPrefix: CLASS_PREFIX,
2984
- offset: this.config.offset,
2985
- constraints: this.config.constraints,
2986
- addTargetClasses: false
3205
+ this._popper = new Popper(this.element, tip, {
3206
+ placement: attachment,
3207
+ modifiers: {
3208
+ offset: {
3209
+ offset: this.config.offset
3210
+ },
3211
+ flip: {
3212
+ behavior: this.config.fallbackPlacement
3213
+ },
3214
+ arrow: {
3215
+ element: Selector.ARROW
3216
+ }
3217
+ },
3218
+ onCreate: function onCreate(data) {
3219
+ if (data.originalPlacement !== data.placement) {
3220
+ _this24._handlePopperPlacementChange(data);
3221
+ }
3222
+ },
3223
+ onUpdate: function onUpdate(data) {
3224
+ _this24._handlePopperPlacementChange(data);
3225
+ }
2987
3226
  });
2988
3227
 
2989
- Util.reflow(tip);
2990
- this._tether.position();
2991
-
2992
3228
  $(tip).addClass(ClassName.SHOW);
2993
3229
 
3230
+ // if this is a touch-enabled device we add extra
3231
+ // empty mouseover listeners to the body's immediate children;
3232
+ // only needed because of broken event delegation on iOS
3233
+ // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
3234
+ if ('ontouchstart' in document.documentElement) {
3235
+ $('body').children().on('mouseover', null, $.noop);
3236
+ }
3237
+
2994
3238
  var complete = function complete() {
2995
- var prevHoverState = _this22._hoverState;
2996
- _this22._hoverState = null;
2997
- _this22._isTransitioning = false;
3239
+ if (_this24.config.animation) {
3240
+ _this24._fixTransition();
3241
+ }
3242
+ var prevHoverState = _this24._hoverState;
3243
+ _this24._hoverState = null;
2998
3244
 
2999
- $(_this22.element).trigger(_this22.constructor.Event.SHOWN);
3245
+ $(_this24.element).trigger(_this24.constructor.Event.SHOWN);
3000
3246
 
3001
3247
  if (prevHoverState === HoverState.OUT) {
3002
- _this22._leave(null, _this22);
3248
+ _this24._leave(null, _this24);
3003
3249
  }
3004
3250
  };
3005
3251
 
3006
3252
  if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
3007
- this._isTransitioning = true;
3008
3253
  $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
3009
- return;
3254
+ } else {
3255
+ complete();
3010
3256
  }
3011
-
3012
- complete();
3013
3257
  }
3014
3258
  };
3015
3259
 
3016
3260
  Tooltip.prototype.hide = function hide(callback) {
3017
- var _this23 = this;
3261
+ var _this25 = this;
3018
3262
 
3019
3263
  var tip = this.getTipElement();
3020
3264
  var hideEvent = $.Event(this.constructor.Event.HIDE);
3021
- if (this._isTransitioning) {
3022
- throw new Error('Tooltip is transitioning');
3023
- }
3024
3265
  var complete = function complete() {
3025
- if (_this23._hoverState !== HoverState.SHOW && tip.parentNode) {
3266
+ if (_this25._hoverState !== HoverState.SHOW && tip.parentNode) {
3026
3267
  tip.parentNode.removeChild(tip);
3027
3268
  }
3028
3269
 
3029
- _this23.element.removeAttribute('aria-describedby');
3030
- $(_this23.element).trigger(_this23.constructor.Event.HIDDEN);
3031
- _this23._isTransitioning = false;
3032
- _this23.cleanupTether();
3270
+ _this25._cleanTipClass();
3271
+ _this25.element.removeAttribute('aria-describedby');
3272
+ $(_this25.element).trigger(_this25.constructor.Event.HIDDEN);
3273
+ if (_this25._popper !== null) {
3274
+ _this25._popper.destroy();
3275
+ }
3033
3276
 
3034
3277
  if (callback) {
3035
3278
  callback();
@@ -3044,12 +3287,18 @@ var Tooltip = function ($) {
3044
3287
 
3045
3288
  $(tip).removeClass(ClassName.SHOW);
3046
3289
 
3290
+ // if this is a touch-enabled device we remove the extra
3291
+ // empty mouseover listeners we added for iOS support
3292
+ if ('ontouchstart' in document.documentElement) {
3293
+ $('body').children().off('mouseover', null, $.noop);
3294
+ }
3295
+
3047
3296
  this._activeTrigger[Trigger.CLICK] = false;
3048
3297
  this._activeTrigger[Trigger.FOCUS] = false;
3049
3298
  this._activeTrigger[Trigger.HOVER] = false;
3050
3299
 
3051
3300
  if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
3052
- this._isTransitioning = true;
3301
+
3053
3302
  $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
3054
3303
  } else {
3055
3304
  complete();
@@ -3058,24 +3307,30 @@ var Tooltip = function ($) {
3058
3307
  this._hoverState = '';
3059
3308
  };
3060
3309
 
3310
+ Tooltip.prototype.update = function update() {
3311
+ if (this._popper !== null) {
3312
+ this._popper.scheduleUpdate();
3313
+ }
3314
+ };
3315
+
3061
3316
  // protected
3062
3317
 
3063
3318
  Tooltip.prototype.isWithContent = function isWithContent() {
3064
3319
  return Boolean(this.getTitle());
3065
3320
  };
3066
3321
 
3322
+ Tooltip.prototype.addAttachmentClass = function addAttachmentClass(attachment) {
3323
+ $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment);
3324
+ };
3325
+
3067
3326
  Tooltip.prototype.getTipElement = function getTipElement() {
3068
3327
  return this.tip = this.tip || $(this.config.template)[0];
3069
3328
  };
3070
3329
 
3071
3330
  Tooltip.prototype.setContent = function setContent() {
3072
3331
  var $tip = $(this.getTipElement());
3073
-
3074
3332
  this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
3075
-
3076
3333
  $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
3077
-
3078
- this.cleanupTether();
3079
3334
  };
3080
3335
 
3081
3336
  Tooltip.prototype.setElementContent = function setElementContent($element, content) {
@@ -3104,12 +3359,6 @@ var Tooltip = function ($) {
3104
3359
  return title;
3105
3360
  };
3106
3361
 
3107
- Tooltip.prototype.cleanupTether = function cleanupTether() {
3108
- if (this._tether) {
3109
- this._tether.destroy();
3110
- }
3111
- };
3112
-
3113
3362
  // private
3114
3363
 
3115
3364
  Tooltip.prototype._getAttachment = function _getAttachment(placement) {
@@ -3117,28 +3366,28 @@ var Tooltip = function ($) {
3117
3366
  };
3118
3367
 
3119
3368
  Tooltip.prototype._setListeners = function _setListeners() {
3120
- var _this24 = this;
3369
+ var _this26 = this;
3121
3370
 
3122
3371
  var triggers = this.config.trigger.split(' ');
3123
3372
 
3124
3373
  triggers.forEach(function (trigger) {
3125
3374
  if (trigger === 'click') {
3126
- $(_this24.element).on(_this24.constructor.Event.CLICK, _this24.config.selector, function (event) {
3127
- return _this24.toggle(event);
3375
+ $(_this26.element).on(_this26.constructor.Event.CLICK, _this26.config.selector, function (event) {
3376
+ return _this26.toggle(event);
3128
3377
  });
3129
3378
  } else if (trigger !== Trigger.MANUAL) {
3130
- var eventIn = trigger === Trigger.HOVER ? _this24.constructor.Event.MOUSEENTER : _this24.constructor.Event.FOCUSIN;
3131
- var eventOut = trigger === Trigger.HOVER ? _this24.constructor.Event.MOUSELEAVE : _this24.constructor.Event.FOCUSOUT;
3379
+ var eventIn = trigger === Trigger.HOVER ? _this26.constructor.Event.MOUSEENTER : _this26.constructor.Event.FOCUSIN;
3380
+ var eventOut = trigger === Trigger.HOVER ? _this26.constructor.Event.MOUSELEAVE : _this26.constructor.Event.FOCUSOUT;
3132
3381
 
3133
- $(_this24.element).on(eventIn, _this24.config.selector, function (event) {
3134
- return _this24._enter(event);
3135
- }).on(eventOut, _this24.config.selector, function (event) {
3136
- return _this24._leave(event);
3382
+ $(_this26.element).on(eventIn, _this26.config.selector, function (event) {
3383
+ return _this26._enter(event);
3384
+ }).on(eventOut, _this26.config.selector, function (event) {
3385
+ return _this26._leave(event);
3137
3386
  });
3138
3387
  }
3139
3388
 
3140
- $(_this24.element).closest('.modal').on('hide.bs.modal', function () {
3141
- return _this24.hide();
3389
+ $(_this26.element).closest('.modal').on('hide.bs.modal', function () {
3390
+ return _this26.hide();
3142
3391
  });
3143
3392
  });
3144
3393
 
@@ -3249,6 +3498,14 @@ var Tooltip = function ($) {
3249
3498
  };
3250
3499
  }
3251
3500
 
3501
+ if (config.title && typeof config.title === 'number') {
3502
+ config.title = config.title.toString();
3503
+ }
3504
+
3505
+ if (config.content && typeof config.content === 'number') {
3506
+ config.content = config.content.toString();
3507
+ }
3508
+
3252
3509
  Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
3253
3510
 
3254
3511
  return config;
@@ -3268,6 +3525,32 @@ var Tooltip = function ($) {
3268
3525
  return config;
3269
3526
  };
3270
3527
 
3528
+ Tooltip.prototype._cleanTipClass = function _cleanTipClass() {
3529
+ var $tip = $(this.getTipElement());
3530
+ var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
3531
+ if (tabClass !== null && tabClass.length > 0) {
3532
+ $tip.removeClass(tabClass.join(''));
3533
+ }
3534
+ };
3535
+
3536
+ Tooltip.prototype._handlePopperPlacementChange = function _handlePopperPlacementChange(data) {
3537
+ this._cleanTipClass();
3538
+ this.addAttachmentClass(this._getAttachment(data.placement));
3539
+ };
3540
+
3541
+ Tooltip.prototype._fixTransition = function _fixTransition() {
3542
+ var tip = this.getTipElement();
3543
+ var initConfigAnimation = this.config.animation;
3544
+ if (tip.getAttribute('x-placement') !== null) {
3545
+ return;
3546
+ }
3547
+ $(tip).removeClass(ClassName.FADE);
3548
+ this.config.animation = false;
3549
+ this.hide();
3550
+ this.show();
3551
+ this.config.animation = initConfigAnimation;
3552
+ };
3553
+
3271
3554
  // static
3272
3555
 
3273
3556
  Tooltip._jQueryInterface = function _jQueryInterface(config) {
@@ -3351,7 +3634,7 @@ var Tooltip = function ($) {
3351
3634
 
3352
3635
  /**
3353
3636
  * --------------------------------------------------------------------------
3354
- * Bootstrap (v4.0.0-alpha.6): popover.js
3637
+ * Bootstrap (v4.0.0-beta): popover.js
3355
3638
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
3356
3639
  * --------------------------------------------------------------------------
3357
3640
  */
@@ -3365,16 +3648,18 @@ var Popover = function ($) {
3365
3648
  */
3366
3649
 
3367
3650
  var NAME = 'popover';
3368
- var VERSION = '4.0.0-alpha.6';
3651
+ var VERSION = '4.0.0-beta';
3369
3652
  var DATA_KEY = 'bs.popover';
3370
3653
  var EVENT_KEY = '.' + DATA_KEY;
3371
3654
  var JQUERY_NO_CONFLICT = $.fn[NAME];
3655
+ var CLASS_PREFIX = 'bs-popover';
3656
+ var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g');
3372
3657
 
3373
3658
  var Default = $.extend({}, Tooltip.Default, {
3374
3659
  placement: 'right',
3375
3660
  trigger: 'click',
3376
3661
  content: '',
3377
- template: '<div class="popover" role="tooltip">' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>'
3662
+ template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
3378
3663
  });
3379
3664
 
3380
3665
  var DefaultType = $.extend({}, Tooltip.DefaultType, {
@@ -3387,8 +3672,8 @@ var Popover = function ($) {
3387
3672
  };
3388
3673
 
3389
3674
  var Selector = {
3390
- TITLE: '.popover-title',
3391
- CONTENT: '.popover-content'
3675
+ TITLE: '.popover-header',
3676
+ CONTENT: '.popover-body'
3392
3677
  };
3393
3678
 
3394
3679
  var Event = {
@@ -3402,14 +3687,14 @@ var Popover = function ($) {
3402
3687
  FOCUSOUT: 'focusout' + EVENT_KEY,
3403
3688
  MOUSEENTER: 'mouseenter' + EVENT_KEY,
3404
3689
  MOUSELEAVE: 'mouseleave' + EVENT_KEY
3405
- };
3406
3690
 
3407
- /**
3408
- * ------------------------------------------------------------------------
3409
- * Class Definition
3410
- * ------------------------------------------------------------------------
3411
- */
3691
+ /**
3692
+ * ------------------------------------------------------------------------
3693
+ * Class Definition
3694
+ * ------------------------------------------------------------------------
3695
+ */
3412
3696
 
3697
+ };
3413
3698
  var Popover = function (_Tooltip) {
3414
3699
  _inherits(Popover, _Tooltip);
3415
3700
 
@@ -3425,6 +3710,10 @@ var Popover = function ($) {
3425
3710
  return this.getTitle() || this._getContent();
3426
3711
  };
3427
3712
 
3713
+ Popover.prototype.addAttachmentClass = function addAttachmentClass(attachment) {
3714
+ $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment);
3715
+ };
3716
+
3428
3717
  Popover.prototype.getTipElement = function getTipElement() {
3429
3718
  return this.tip = this.tip || $(this.config.template)[0];
3430
3719
  };
@@ -3437,8 +3726,6 @@ var Popover = function ($) {
3437
3726
  this.setElementContent($tip.find(Selector.CONTENT), this._getContent());
3438
3727
 
3439
3728
  $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
3440
-
3441
- this.cleanupTether();
3442
3729
  };
3443
3730
 
3444
3731
  // private
@@ -3447,6 +3734,14 @@ var Popover = function ($) {
3447
3734
  return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content);
3448
3735
  };
3449
3736
 
3737
+ Popover.prototype._cleanTipClass = function _cleanTipClass() {
3738
+ var $tip = $(this.getTipElement());
3739
+ var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
3740
+ if (tabClass !== null && tabClass.length > 0) {
3741
+ $tip.removeClass(tabClass.join(''));
3742
+ }
3743
+ };
3744
+
3450
3745
  // static
3451
3746
 
3452
3747
  Popover._jQueryInterface = function _jQueryInterface(config) {
@@ -3532,4 +3827,5 @@ var Popover = function ($) {
3532
3827
  return Popover;
3533
3828
  }(jQuery);
3534
3829
 
3535
- }();
3830
+
3831
+ })();