1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
This commit is contained in:
Mark Otto 2018-06-21 22:55:23 -07:00
parent e59265c42d
commit eadeab9d1c
36 changed files with 349 additions and 242 deletions

File diff suppressed because one or more lines are too long

View file

@ -17,7 +17,7 @@ html {
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%; -ms-text-size-adjust: 100%;
-ms-overflow-style: scrollbar; -ms-overflow-style: scrollbar;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
} }
@-ms-viewport { @-ms-viewport {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -47,7 +47,7 @@ html {
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%; -ms-text-size-adjust: 100%;
-ms-overflow-style: scrollbar; -ms-overflow-style: scrollbar;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
} }
@-ms-viewport { @-ms-viewport {
@ -3354,12 +3354,6 @@ input[type="button"].btn-block {
margin-bottom: 0; margin-bottom: 0;
} }
.input-group > .form-control:focus,
.input-group > .custom-select:focus,
.input-group > .custom-file:focus {
z-index: 3;
}
.input-group > .form-control + .form-control, .input-group > .form-control + .form-control,
.input-group > .form-control + .custom-select, .input-group > .form-control + .custom-select,
.input-group > .form-control + .custom-file, .input-group > .form-control + .custom-file,
@ -3372,6 +3366,12 @@ input[type="button"].btn-block {
margin-left: -1px; margin-left: -1px;
} }
.input-group > .form-control:focus,
.input-group > .custom-select:focus,
.input-group > .custom-file .custom-file-input:focus ~ .custom-file-label {
z-index: 3;
}
.input-group > .form-control:not(:last-child), .input-group > .form-control:not(:last-child),
.input-group > .custom-select:not(:last-child) { .input-group > .custom-select:not(:last-child) {
border-top-right-radius: 0; border-top-right-radius: 0;
@ -3678,6 +3678,10 @@ input[type="button"].btn-block {
border-color: #80bdff; border-color: #80bdff;
} }
.custom-file-input:disabled ~ .custom-file-label {
background-color: #e9ecef;
}
.custom-file-input:lang(en) ~ .custom-file-label::after { .custom-file-input:lang(en) ~ .custom-file-label::after {
content: "Browse"; content: "Browse";
} }
@ -3738,10 +3742,17 @@ input[type="button"].btn-block {
background-color: #007bff; background-color: #007bff;
border: 0; border: 0;
border-radius: 1rem; border-radius: 1rem;
transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
-webkit-appearance: none; -webkit-appearance: none;
appearance: none; appearance: none;
} }
@media screen and (prefers-reduced-motion: reduce) {
.custom-range::-webkit-slider-thumb {
transition: none;
}
}
.custom-range::-webkit-slider-thumb:focus { .custom-range::-webkit-slider-thumb:focus {
outline: none; outline: none;
box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25); box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
@ -3767,10 +3778,17 @@ input[type="button"].btn-block {
background-color: #007bff; background-color: #007bff;
border: 0; border: 0;
border-radius: 1rem; border-radius: 1rem;
transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
-moz-appearance: none; -moz-appearance: none;
appearance: none; appearance: none;
} }
@media screen and (prefers-reduced-motion: reduce) {
.custom-range::-moz-range-thumb {
transition: none;
}
}
.custom-range::-moz-range-thumb:focus { .custom-range::-moz-range-thumb:focus {
outline: none; outline: none;
box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25); box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
@ -3796,9 +3814,16 @@ input[type="button"].btn-block {
background-color: #007bff; background-color: #007bff;
border: 0; border: 0;
border-radius: 1rem; border-radius: 1rem;
transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
appearance: none; appearance: none;
} }
@media screen and (prefers-reduced-motion: reduce) {
.custom-range::-ms-thumb {
transition: none;
}
}
.custom-range::-ms-thumb:focus { .custom-range::-ms-thumb:focus {
outline: none; outline: none;
box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25); box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
@ -3829,6 +3854,20 @@ input[type="button"].btn-block {
border-radius: 1rem; border-radius: 1rem;
} }
.custom-control-label::before,
.custom-file-label,
.custom-select {
transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
@media screen and (prefers-reduced-motion: reduce) {
.custom-control-label::before,
.custom-file-label,
.custom-select {
transition: none;
}
}
.nav { .nav {
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
@ -5283,16 +5322,16 @@ input[type="button"].btn-block {
opacity: .5; opacity: .5;
} }
.close:hover, .close:focus { .close:not(:disabled):not(.disabled) {
cursor: pointer;
}
.close:not(:disabled):not(.disabled):hover, .close:not(:disabled):not(.disabled):focus {
color: #000; color: #000;
text-decoration: none; text-decoration: none;
opacity: .75; opacity: .75;
} }
.close:not(:disabled):not(.disabled) {
cursor: pointer;
}
button.close { button.close {
padding: 0; padding: 0;
background-color: transparent; background-color: transparent;
@ -5777,25 +5816,27 @@ button.close {
-ms-flex-align: center; -ms-flex-align: center;
align-items: center; align-items: center;
width: 100%; width: 100%;
transition: -webkit-transform 0.6s ease;
transition: transform 0.6s ease;
transition: transform 0.6s ease, -webkit-transform 0.6s ease;
-webkit-backface-visibility: hidden; -webkit-backface-visibility: hidden;
backface-visibility: hidden; backface-visibility: hidden;
-webkit-perspective: 1000px; -webkit-perspective: 1000px;
perspective: 1000px; perspective: 1000px;
} }
@media screen and (prefers-reduced-motion: reduce) {
.carousel-item {
transition: none;
}
}
.carousel-item.active, .carousel-item.active,
.carousel-item-next, .carousel-item-next,
.carousel-item-prev { .carousel-item-prev {
display: block; display: block;
transition: -webkit-transform 0.6s ease;
transition: transform 0.6s ease;
transition: transform 0.6s ease, -webkit-transform 0.6s ease;
}
@media screen and (prefers-reduced-motion: reduce) {
.carousel-item.active,
.carousel-item-next,
.carousel-item-prev {
transition: none;
}
} }
.carousel-item-next, .carousel-item-next,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -146,8 +146,7 @@
} }
try { try {
var $selector = $$$1(document).find(selector); return document.querySelector(selector) ? selector : null;
return $selector.length > 0 ? selector : null;
} catch (err) { } catch (err) {
return null; return null;
} }
@ -277,7 +276,7 @@
var parent = false; var parent = false;
if (selector) { if (selector) {
parent = $$$1(selector)[0]; parent = document.querySelector(selector);
} }
if (!parent) { if (!parent) {
@ -434,14 +433,14 @@
var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0]; var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0];
if (rootElement) { if (rootElement) {
var input = $$$1(this._element).find(Selector.INPUT)[0]; var input = this._element.querySelector(Selector.INPUT);
if (input) { if (input) {
if (input.type === 'radio') { if (input.type === 'radio') {
if (input.checked && $$$1(this._element).hasClass(ClassName.ACTIVE)) { if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) {
triggerChangeEvent = false; triggerChangeEvent = false;
} else { } else {
var activeElement = $$$1(rootElement).find(Selector.ACTIVE)[0]; var activeElement = rootElement.querySelector(Selector.ACTIVE);
if (activeElement) { if (activeElement) {
$$$1(activeElement).removeClass(ClassName.ACTIVE); $$$1(activeElement).removeClass(ClassName.ACTIVE);
@ -454,7 +453,7 @@
return; return;
} }
input.checked = !$$$1(this._element).hasClass(ClassName.ACTIVE); input.checked = !this._element.classList.contains(ClassName.ACTIVE);
$$$1(input).trigger('change'); $$$1(input).trigger('change');
} }
@ -464,7 +463,7 @@
} }
if (addAriaPressed) { if (addAriaPressed) {
this._element.setAttribute('aria-pressed', !$$$1(this._element).hasClass(ClassName.ACTIVE)); this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName.ACTIVE));
} }
if (triggerChangeEvent) { if (triggerChangeEvent) {
@ -632,7 +631,7 @@
this.touchTimeout = null; this.touchTimeout = null;
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._element = $$$1(element)[0]; this._element = $$$1(element)[0];
this._indicatorsElement = $$$1(this._element).find(Selector.INDICATORS)[0]; this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
this._addEventListeners(); this._addEventListeners();
} // Getters } // Getters
@ -666,7 +665,7 @@
this._isPaused = true; this._isPaused = true;
} }
if ($$$1(this._element).find(Selector.NEXT_PREV)[0]) { if (this._element.querySelector(Selector.NEXT_PREV)) {
Util.triggerTransitionEnd(this._element); Util.triggerTransitionEnd(this._element);
this.cycle(true); this.cycle(true);
} }
@ -693,7 +692,7 @@
_proto.to = function to(index) { _proto.to = function to(index) {
var _this = this; var _this = this;
this._activeElement = $$$1(this._element).find(Selector.ACTIVE_ITEM)[0]; this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
var activeIndex = this._getItemIndex(this._activeElement); var activeIndex = this._getItemIndex(this._activeElement);
@ -799,7 +798,7 @@
}; };
_proto._getItemIndex = function _getItemIndex(element) { _proto._getItemIndex = function _getItemIndex(element) {
this._items = $$$1.makeArray($$$1(element).parent().find(Selector.ITEM)); this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
return this._items.indexOf(element); return this._items.indexOf(element);
}; };
@ -824,7 +823,7 @@
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
var targetIndex = this._getItemIndex(relatedTarget); var targetIndex = this._getItemIndex(relatedTarget);
var fromIndex = this._getItemIndex($$$1(this._element).find(Selector.ACTIVE_ITEM)[0]); var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
var slideEvent = $$$1.Event(Event.SLIDE, { var slideEvent = $$$1.Event(Event.SLIDE, {
relatedTarget: relatedTarget, relatedTarget: relatedTarget,
@ -838,7 +837,8 @@
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
if (this._indicatorsElement) { if (this._indicatorsElement) {
$$$1(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE); var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
$$$1(indicators).removeClass(ClassName.ACTIVE);
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
@ -851,7 +851,7 @@
_proto._slide = function _slide(direction, element) { _proto._slide = function _slide(direction, element) {
var _this3 = this; var _this3 = this;
var activeElement = $$$1(this._element).find(Selector.ACTIVE_ITEM)[0]; var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
var activeElementIndex = this._getItemIndex(activeElement); var activeElementIndex = this._getItemIndex(activeElement);
@ -1017,11 +1017,13 @@
$$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler); $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
$$$1(window).on(Event.LOAD_DATA_API, function () { $$$1(window).on(Event.LOAD_DATA_API, function () {
$$$1(Selector.DATA_RIDE).each(function () { var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
var $carousel = $$$1(this);
for (var i = 0, len = carousels.length; i < len; i++) {
var $carousel = $$$1(carousels[i]);
Carousel._jQueryInterface.call($carousel, $carousel.data()); Carousel._jQueryInterface.call($carousel, $carousel.data());
}); }
}); });
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -1102,14 +1104,17 @@
this._isTransitioning = false; this._isTransitioning = false;
this._element = element; this._element = element;
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._triggerArray = $$$1.makeArray($$$1("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); this._triggerArray = $$$1.makeArray(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
var tabToggles = $$$1(Selector.DATA_TOGGLE); var toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
for (var i = 0; i < tabToggles.length; i++) { for (var i = 0, len = toggleList.length; i < len; i++) {
var elem = tabToggles[i]; var elem = toggleList[i];
var selector = Util.getSelectorFromElement(elem); var selector = Util.getSelectorFromElement(elem);
var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
return foundElem === element;
});
if (selector !== null && $$$1(selector).filter(element).length > 0) { if (selector !== null && filterElement.length > 0) {
this._selector = selector; this._selector = selector;
this._triggerArray.push(elem); this._triggerArray.push(elem);
@ -1150,7 +1155,9 @@
var activesData; var activesData;
if (this._parent) { if (this._parent) {
actives = $$$1.makeArray($$$1(this._parent).find(Selector.ACTIVES).filter("[data-parent=\"" + this._config.parent + "\"]")); actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES)).filter(function (elem) {
return elem.getAttribute('data-parent') === _this._config.parent;
});
if (actives.length === 0) { if (actives.length === 0) {
actives = null; actives = null;
@ -1185,7 +1192,7 @@
$$$1(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING); $$$1(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
this._element.style[dimension] = 0; this._element.style[dimension] = 0;
if (this._triggerArray.length > 0) { if (this._triggerArray.length) {
$$$1(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true); $$$1(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
} }
@ -1226,14 +1233,15 @@
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
Util.reflow(this._element); Util.reflow(this._element);
$$$1(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW); $$$1(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
var triggerArrayLength = this._triggerArray.length;
if (this._triggerArray.length > 0) { if (triggerArrayLength > 0) {
for (var i = 0; i < this._triggerArray.length; i++) { for (var i = 0; i < triggerArrayLength; i++) {
var trigger = this._triggerArray[i]; var trigger = this._triggerArray[i];
var selector = Util.getSelectorFromElement(trigger); var selector = Util.getSelectorFromElement(trigger);
if (selector !== null) { if (selector !== null) {
var $elem = $$$1(selector); var $elem = $$$1([].slice.call(document.querySelectorAll(selector)));
if (!$elem.hasClass(ClassName.SHOW)) { if (!$elem.hasClass(ClassName.SHOW)) {
$$$1(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false); $$$1(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
@ -1294,11 +1302,12 @@
parent = this._config.parent[0]; parent = this._config.parent[0];
} }
} else { } else {
parent = $$$1(this._config.parent)[0]; parent = document.querySelector(this._config.parent);
} }
var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
$$$1(parent).find(selector).each(function (i, element) { var children = [].slice.call(parent.querySelectorAll(selector));
$$$1(children).each(function (i, element) {
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
}); });
return parent; return parent;
@ -1308,7 +1317,7 @@
if (element) { if (element) {
var isOpen = $$$1(element).hasClass(ClassName.SHOW); var isOpen = $$$1(element).hasClass(ClassName.SHOW);
if (triggerArray.length > 0) { if (triggerArray.length) {
$$$1(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); $$$1(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
} }
} }
@ -1317,7 +1326,7 @@
Collapse._getTargetFromElement = function _getTargetFromElement(element) { Collapse._getTargetFromElement = function _getTargetFromElement(element) {
var selector = Util.getSelectorFromElement(element); var selector = Util.getSelectorFromElement(element);
return selector ? $$$1(selector)[0] : null; return selector ? document.querySelector(selector) : null;
}; };
Collapse._jQueryInterface = function _jQueryInterface(config) { Collapse._jQueryInterface = function _jQueryInterface(config) {
@ -1375,7 +1384,8 @@
var $trigger = $$$1(this); var $trigger = $$$1(this);
var selector = Util.getSelectorFromElement(this); var selector = Util.getSelectorFromElement(this);
$$$1(selector).each(function () { var selectors = [].slice.call(document.querySelectorAll(selector));
$$$1(selectors).each(function () {
var $target = $$$1(this); var $target = $$$1(this);
var data = $target.data(DATA_KEY); var data = $target.data(DATA_KEY);
var config = data ? 'toggle' : $trigger.data(); var config = data ? 'toggle' : $trigger.data();
@ -4141,14 +4151,16 @@
if (!this._menu) { if (!this._menu) {
var parent = Dropdown._getParentFromElement(this._element); var parent = Dropdown._getParentFromElement(this._element);
this._menu = $$$1(parent).find(Selector.MENU)[0]; if (parent) {
this._menu = parent.querySelector(Selector.MENU);
}
} }
return this._menu; return this._menu;
}; };
_proto._getPlacement = function _getPlacement() { _proto._getPlacement = function _getPlacement() {
var $parentDropdown = $$$1(this._element).parent(); var $parentDropdown = $$$1(this._element.parentNode);
var placement = AttachmentMap.BOTTOM; // Handle dropup var placement = AttachmentMap.BOTTOM; // Handle dropup
if ($parentDropdown.hasClass(ClassName.DROPUP)) { if ($parentDropdown.hasClass(ClassName.DROPUP)) {
@ -4236,9 +4248,9 @@
return; return;
} }
var toggles = $$$1.makeArray($$$1(Selector.DATA_TOGGLE)); var toggles = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
for (var i = 0; i < toggles.length; i++) { for (var i = 0, len = toggles.length; i < len; i++) {
var parent = Dropdown._getParentFromElement(toggles[i]); var parent = Dropdown._getParentFromElement(toggles[i]);
var context = $$$1(toggles[i]).data(DATA_KEY); var context = $$$1(toggles[i]).data(DATA_KEY);
@ -4284,7 +4296,7 @@
var selector = Util.getSelectorFromElement(element); var selector = Util.getSelectorFromElement(element);
if (selector) { if (selector) {
parent = $$$1(selector)[0]; parent = document.querySelector(selector);
} }
return parent || element.parentNode; return parent || element.parentNode;
@ -4316,7 +4328,7 @@
if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
if (event.which === ESCAPE_KEYCODE) { if (event.which === ESCAPE_KEYCODE) {
var toggle = $$$1(parent).find(Selector.DATA_TOGGLE)[0]; var toggle = parent.querySelector(Selector.DATA_TOGGLE);
$$$1(toggle).trigger('focus'); $$$1(toggle).trigger('focus');
} }
@ -4324,7 +4336,7 @@
return; return;
} }
var items = $$$1(parent).find(Selector.VISIBLE_ITEMS).get(); var items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS));
if (items.length === 0) { if (items.length === 0) {
return; return;
@ -4474,7 +4486,7 @@
function Modal(element, config) { function Modal(element, config) {
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._element = element; this._element = element;
this._dialog = $$$1(element).find(Selector.DIALOG)[0]; this._dialog = element.querySelector(Selector.DIALOG);
this._backdrop = null; this._backdrop = null;
this._isShown = false; this._isShown = false;
this._isBodyOverflowing = false; this._isBodyOverflowing = false;
@ -4731,7 +4743,7 @@
this._backdrop.className = ClassName.BACKDROP; this._backdrop.className = ClassName.BACKDROP;
if (animate) { if (animate) {
$$$1(this._backdrop).addClass(animate); this._backdrop.classList.add(animate);
} }
$$$1(this._backdrop).appendTo(document.body); $$$1(this._backdrop).appendTo(document.body);
@ -4825,21 +4837,24 @@
if (this._isBodyOverflowing) { if (this._isBodyOverflowing) {
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
// Adjust fixed content padding var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
$$$1(Selector.FIXED_CONTENT).each(function (index, element) { var stickyContent = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT));
var actualPadding = $$$1(element)[0].style.paddingRight; var navbarToggler = [].slice.call(document.querySelectorAll(Selector.NAVBAR_TOGGLER)); // Adjust fixed content padding
$$$1(fixedContent).each(function (index, element) {
var actualPadding = element.style.paddingRight;
var calculatedPadding = $$$1(element).css('padding-right'); var calculatedPadding = $$$1(element).css('padding-right');
$$$1(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); $$$1(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
}); // Adjust sticky content margin }); // Adjust sticky content margin
$$$1(Selector.STICKY_CONTENT).each(function (index, element) { $$$1(stickyContent).each(function (index, element) {
var actualMargin = $$$1(element)[0].style.marginRight; var actualMargin = element.style.marginRight;
var calculatedMargin = $$$1(element).css('margin-right'); var calculatedMargin = $$$1(element).css('margin-right');
$$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); $$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
}); // Adjust navbar-toggler margin }); // Adjust navbar-toggler margin
$$$1(Selector.NAVBAR_TOGGLER).each(function (index, element) { $$$1(navbarToggler).each(function (index, element) {
var actualMargin = $$$1(element)[0].style.marginRight; var actualMargin = element.style.marginRight;
var calculatedMargin = $$$1(element).css('margin-right'); var calculatedMargin = $$$1(element).css('margin-right');
$$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + "px"); $$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + "px");
}); // Adjust body padding }); // Adjust body padding
@ -4852,7 +4867,8 @@
_proto._resetScrollbar = function _resetScrollbar() { _proto._resetScrollbar = function _resetScrollbar() {
// Restore fixed content padding // Restore fixed content padding
$$$1(Selector.FIXED_CONTENT).each(function (index, element) { var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
$$$1(fixedContent).each(function (index, element) {
var padding = $$$1(element).data('padding-right'); var padding = $$$1(element).data('padding-right');
if (typeof padding !== 'undefined') { if (typeof padding !== 'undefined') {
@ -4860,7 +4876,8 @@
} }
}); // Restore sticky content and navbar-toggler margin }); // Restore sticky content and navbar-toggler margin
$$$1(Selector.STICKY_CONTENT + ", " + Selector.NAVBAR_TOGGLER).each(function (index, element) { var elements = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT + ", " + Selector.NAVBAR_TOGGLER));
$$$1(elements).each(function (index, element) {
var margin = $$$1(element).data('margin-right'); var margin = $$$1(element).data('margin-right');
if (typeof margin !== 'undefined') { if (typeof margin !== 'undefined') {
@ -4937,7 +4954,7 @@
var selector = Util.getSelectorFromElement(this); var selector = Util.getSelectorFromElement(this);
if (selector) { if (selector) {
target = $$$1(selector)[0]; target = document.querySelector(selector);
} }
var config = $$$1(target).data(DATA_KEY) ? 'toggle' : _objectSpread({}, $$$1(target).data(), $$$1(this).data()); var config = $$$1(target).data(DATA_KEY) ? 'toggle' : _objectSpread({}, $$$1(target).data(), $$$1(this).data());
@ -5202,7 +5219,7 @@
var attachment = this._getAttachment(placement); var attachment = this._getAttachment(placement);
this.addAttachmentClass(attachment); this.addAttachmentClass(attachment);
var container = this.config.container === false ? document.body : $$$1(this.config.container); var container = this.config.container === false ? document.body : $$$1(document).find(this.config.container);
$$$1(tip).data(this.constructor.DATA_KEY, this); $$$1(tip).data(this.constructor.DATA_KEY, this);
if (!$$$1.contains(this.element.ownerDocument.documentElement, this.tip)) { if (!$$$1.contains(this.element.ownerDocument.documentElement, this.tip)) {
@ -5341,9 +5358,9 @@
}; };
_proto.setContent = function setContent() { _proto.setContent = function setContent() {
var $tip = $$$1(this.getTipElement()); var tip = this.getTipElement();
this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()); this.setElementContent($$$1(tip.querySelectorAll(Selector.TOOLTIP_INNER)), this.getTitle());
$tip.removeClass(ClassName.FADE + " " + ClassName.SHOW); $$$1(tip).removeClass(ClassName.FADE + " " + ClassName.SHOW);
}; };
_proto.setElementContent = function setElementContent($element, content) { _proto.setElementContent = function setElementContent($element, content) {
@ -5536,7 +5553,7 @@
var $tip = $$$1(this.getTipElement()); var $tip = $$$1(this.getTipElement());
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
if (tabClass !== null && tabClass.length > 0) { if (tabClass !== null && tabClass.length) {
$tip.removeClass(tabClass.join('')); $tip.removeClass(tabClass.join(''));
} }
}; };
@ -5938,13 +5955,13 @@
this._offsets = []; this._offsets = [];
this._targets = []; this._targets = [];
this._scrollHeight = this._getScrollHeight(); this._scrollHeight = this._getScrollHeight();
var targets = $$$1.makeArray($$$1(this._selector)); var targets = [].slice.call(document.querySelectorAll(this._selector));
targets.map(function (element) { targets.map(function (element) {
var target; var target;
var targetSelector = Util.getSelectorFromElement(element); var targetSelector = Util.getSelectorFromElement(element);
if (targetSelector) { if (targetSelector) {
target = $$$1(targetSelector)[0]; target = document.querySelector(targetSelector);
} }
if (target) { if (target) {
@ -6041,7 +6058,9 @@
return; return;
} }
for (var i = this._offsets.length; i--;) { var offsetLength = this._offsets.length;
for (var i = offsetLength; i--;) {
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
if (isActiveTarget) { if (isActiveTarget) {
@ -6061,7 +6080,7 @@
queries = queries.map(function (selector) { queries = queries.map(function (selector) {
return selector + "[data-target=\"" + target + "\"]," + (selector + "[href=\"" + target + "\"]"); return selector + "[data-target=\"" + target + "\"]," + (selector + "[href=\"" + target + "\"]");
}); });
var $link = $$$1(queries.join(',')); var $link = $$$1([].slice.call(document.querySelectorAll(queries.join(','))));
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
@ -6082,7 +6101,8 @@
}; };
_proto._clear = function _clear() { _proto._clear = function _clear() {
$$$1(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE); var nodes = [].slice.call(document.querySelectorAll(this._selector));
$$$1(nodes).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
}; // Static }; // Static
@ -6129,9 +6149,10 @@
$$$1(window).on(Event.LOAD_DATA_API, function () { $$$1(window).on(Event.LOAD_DATA_API, function () {
var scrollSpys = $$$1.makeArray($$$1(Selector.DATA_SPY)); var scrollSpys = [].slice.call(document.querySelectorAll(Selector.DATA_SPY));
var scrollSpysLength = scrollSpys.length;
for (var i = scrollSpys.length; i--;) { for (var i = scrollSpysLength; i--;) {
var $spy = $$$1(scrollSpys[i]); var $spy = $$$1(scrollSpys[i]);
ScrollSpy._jQueryInterface.call($spy, $spy.data()); ScrollSpy._jQueryInterface.call($spy, $spy.data());
@ -6250,7 +6271,7 @@
} }
if (selector) { if (selector) {
target = $$$1(selector)[0]; target = document.querySelector(selector);
} }
this._activate(this._element, listElement); this._activate(this._element, listElement);
@ -6332,7 +6353,8 @@
var dropdownElement = $$$1(element).closest(Selector.DROPDOWN)[0]; var dropdownElement = $$$1(element).closest(Selector.DROPDOWN)[0];
if (dropdownElement) { if (dropdownElement) {
$$$1(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector.DROPDOWN_TOGGLE));
$$$1(dropdownToggleList).addClass(ClassName.ACTIVE);
} }
element.setAttribute('aria-expanded', true); element.setAttribute('aria-expanded', true);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -147,8 +147,7 @@
} }
try { try {
var $selector = $$$1(document).find(selector); return document.querySelector(selector) ? selector : null;
return $selector.length > 0 ? selector : null;
} catch (err) { } catch (err) {
return null; return null;
} }
@ -278,7 +277,7 @@
var parent = false; var parent = false;
if (selector) { if (selector) {
parent = $$$1(selector)[0]; parent = document.querySelector(selector);
} }
if (!parent) { if (!parent) {
@ -435,14 +434,14 @@
var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0]; var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0];
if (rootElement) { if (rootElement) {
var input = $$$1(this._element).find(Selector.INPUT)[0]; var input = this._element.querySelector(Selector.INPUT);
if (input) { if (input) {
if (input.type === 'radio') { if (input.type === 'radio') {
if (input.checked && $$$1(this._element).hasClass(ClassName.ACTIVE)) { if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) {
triggerChangeEvent = false; triggerChangeEvent = false;
} else { } else {
var activeElement = $$$1(rootElement).find(Selector.ACTIVE)[0]; var activeElement = rootElement.querySelector(Selector.ACTIVE);
if (activeElement) { if (activeElement) {
$$$1(activeElement).removeClass(ClassName.ACTIVE); $$$1(activeElement).removeClass(ClassName.ACTIVE);
@ -455,7 +454,7 @@
return; return;
} }
input.checked = !$$$1(this._element).hasClass(ClassName.ACTIVE); input.checked = !this._element.classList.contains(ClassName.ACTIVE);
$$$1(input).trigger('change'); $$$1(input).trigger('change');
} }
@ -465,7 +464,7 @@
} }
if (addAriaPressed) { if (addAriaPressed) {
this._element.setAttribute('aria-pressed', !$$$1(this._element).hasClass(ClassName.ACTIVE)); this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName.ACTIVE));
} }
if (triggerChangeEvent) { if (triggerChangeEvent) {
@ -633,7 +632,7 @@
this.touchTimeout = null; this.touchTimeout = null;
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._element = $$$1(element)[0]; this._element = $$$1(element)[0];
this._indicatorsElement = $$$1(this._element).find(Selector.INDICATORS)[0]; this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
this._addEventListeners(); this._addEventListeners();
} // Getters } // Getters
@ -667,7 +666,7 @@
this._isPaused = true; this._isPaused = true;
} }
if ($$$1(this._element).find(Selector.NEXT_PREV)[0]) { if (this._element.querySelector(Selector.NEXT_PREV)) {
Util.triggerTransitionEnd(this._element); Util.triggerTransitionEnd(this._element);
this.cycle(true); this.cycle(true);
} }
@ -694,7 +693,7 @@
_proto.to = function to(index) { _proto.to = function to(index) {
var _this = this; var _this = this;
this._activeElement = $$$1(this._element).find(Selector.ACTIVE_ITEM)[0]; this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
var activeIndex = this._getItemIndex(this._activeElement); var activeIndex = this._getItemIndex(this._activeElement);
@ -800,7 +799,7 @@
}; };
_proto._getItemIndex = function _getItemIndex(element) { _proto._getItemIndex = function _getItemIndex(element) {
this._items = $$$1.makeArray($$$1(element).parent().find(Selector.ITEM)); this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
return this._items.indexOf(element); return this._items.indexOf(element);
}; };
@ -825,7 +824,7 @@
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
var targetIndex = this._getItemIndex(relatedTarget); var targetIndex = this._getItemIndex(relatedTarget);
var fromIndex = this._getItemIndex($$$1(this._element).find(Selector.ACTIVE_ITEM)[0]); var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
var slideEvent = $$$1.Event(Event.SLIDE, { var slideEvent = $$$1.Event(Event.SLIDE, {
relatedTarget: relatedTarget, relatedTarget: relatedTarget,
@ -839,7 +838,8 @@
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
if (this._indicatorsElement) { if (this._indicatorsElement) {
$$$1(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE); var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
$$$1(indicators).removeClass(ClassName.ACTIVE);
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
@ -852,7 +852,7 @@
_proto._slide = function _slide(direction, element) { _proto._slide = function _slide(direction, element) {
var _this3 = this; var _this3 = this;
var activeElement = $$$1(this._element).find(Selector.ACTIVE_ITEM)[0]; var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
var activeElementIndex = this._getItemIndex(activeElement); var activeElementIndex = this._getItemIndex(activeElement);
@ -1018,11 +1018,13 @@
$$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler); $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
$$$1(window).on(Event.LOAD_DATA_API, function () { $$$1(window).on(Event.LOAD_DATA_API, function () {
$$$1(Selector.DATA_RIDE).each(function () { var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
var $carousel = $$$1(this);
for (var i = 0, len = carousels.length; i < len; i++) {
var $carousel = $$$1(carousels[i]);
Carousel._jQueryInterface.call($carousel, $carousel.data()); Carousel._jQueryInterface.call($carousel, $carousel.data());
}); }
}); });
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -1103,14 +1105,17 @@
this._isTransitioning = false; this._isTransitioning = false;
this._element = element; this._element = element;
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._triggerArray = $$$1.makeArray($$$1("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); this._triggerArray = $$$1.makeArray(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
var tabToggles = $$$1(Selector.DATA_TOGGLE); var toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
for (var i = 0; i < tabToggles.length; i++) { for (var i = 0, len = toggleList.length; i < len; i++) {
var elem = tabToggles[i]; var elem = toggleList[i];
var selector = Util.getSelectorFromElement(elem); var selector = Util.getSelectorFromElement(elem);
var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
return foundElem === element;
});
if (selector !== null && $$$1(selector).filter(element).length > 0) { if (selector !== null && filterElement.length > 0) {
this._selector = selector; this._selector = selector;
this._triggerArray.push(elem); this._triggerArray.push(elem);
@ -1151,7 +1156,9 @@
var activesData; var activesData;
if (this._parent) { if (this._parent) {
actives = $$$1.makeArray($$$1(this._parent).find(Selector.ACTIVES).filter("[data-parent=\"" + this._config.parent + "\"]")); actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES)).filter(function (elem) {
return elem.getAttribute('data-parent') === _this._config.parent;
});
if (actives.length === 0) { if (actives.length === 0) {
actives = null; actives = null;
@ -1186,7 +1193,7 @@
$$$1(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING); $$$1(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
this._element.style[dimension] = 0; this._element.style[dimension] = 0;
if (this._triggerArray.length > 0) { if (this._triggerArray.length) {
$$$1(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true); $$$1(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
} }
@ -1227,14 +1234,15 @@
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
Util.reflow(this._element); Util.reflow(this._element);
$$$1(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW); $$$1(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
var triggerArrayLength = this._triggerArray.length;
if (this._triggerArray.length > 0) { if (triggerArrayLength > 0) {
for (var i = 0; i < this._triggerArray.length; i++) { for (var i = 0; i < triggerArrayLength; i++) {
var trigger = this._triggerArray[i]; var trigger = this._triggerArray[i];
var selector = Util.getSelectorFromElement(trigger); var selector = Util.getSelectorFromElement(trigger);
if (selector !== null) { if (selector !== null) {
var $elem = $$$1(selector); var $elem = $$$1([].slice.call(document.querySelectorAll(selector)));
if (!$elem.hasClass(ClassName.SHOW)) { if (!$elem.hasClass(ClassName.SHOW)) {
$$$1(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false); $$$1(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
@ -1295,11 +1303,12 @@
parent = this._config.parent[0]; parent = this._config.parent[0];
} }
} else { } else {
parent = $$$1(this._config.parent)[0]; parent = document.querySelector(this._config.parent);
} }
var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
$$$1(parent).find(selector).each(function (i, element) { var children = [].slice.call(parent.querySelectorAll(selector));
$$$1(children).each(function (i, element) {
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
}); });
return parent; return parent;
@ -1309,7 +1318,7 @@
if (element) { if (element) {
var isOpen = $$$1(element).hasClass(ClassName.SHOW); var isOpen = $$$1(element).hasClass(ClassName.SHOW);
if (triggerArray.length > 0) { if (triggerArray.length) {
$$$1(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); $$$1(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
} }
} }
@ -1318,7 +1327,7 @@
Collapse._getTargetFromElement = function _getTargetFromElement(element) { Collapse._getTargetFromElement = function _getTargetFromElement(element) {
var selector = Util.getSelectorFromElement(element); var selector = Util.getSelectorFromElement(element);
return selector ? $$$1(selector)[0] : null; return selector ? document.querySelector(selector) : null;
}; };
Collapse._jQueryInterface = function _jQueryInterface(config) { Collapse._jQueryInterface = function _jQueryInterface(config) {
@ -1376,7 +1385,8 @@
var $trigger = $$$1(this); var $trigger = $$$1(this);
var selector = Util.getSelectorFromElement(this); var selector = Util.getSelectorFromElement(this);
$$$1(selector).each(function () { var selectors = [].slice.call(document.querySelectorAll(selector));
$$$1(selectors).each(function () {
var $target = $$$1(this); var $target = $$$1(this);
var data = $target.data(DATA_KEY); var data = $target.data(DATA_KEY);
var config = data ? 'toggle' : $trigger.data(); var config = data ? 'toggle' : $trigger.data();
@ -1624,14 +1634,16 @@
if (!this._menu) { if (!this._menu) {
var parent = Dropdown._getParentFromElement(this._element); var parent = Dropdown._getParentFromElement(this._element);
this._menu = $$$1(parent).find(Selector.MENU)[0]; if (parent) {
this._menu = parent.querySelector(Selector.MENU);
}
} }
return this._menu; return this._menu;
}; };
_proto._getPlacement = function _getPlacement() { _proto._getPlacement = function _getPlacement() {
var $parentDropdown = $$$1(this._element).parent(); var $parentDropdown = $$$1(this._element.parentNode);
var placement = AttachmentMap.BOTTOM; // Handle dropup var placement = AttachmentMap.BOTTOM; // Handle dropup
if ($parentDropdown.hasClass(ClassName.DROPUP)) { if ($parentDropdown.hasClass(ClassName.DROPUP)) {
@ -1719,9 +1731,9 @@
return; return;
} }
var toggles = $$$1.makeArray($$$1(Selector.DATA_TOGGLE)); var toggles = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
for (var i = 0; i < toggles.length; i++) { for (var i = 0, len = toggles.length; i < len; i++) {
var parent = Dropdown._getParentFromElement(toggles[i]); var parent = Dropdown._getParentFromElement(toggles[i]);
var context = $$$1(toggles[i]).data(DATA_KEY); var context = $$$1(toggles[i]).data(DATA_KEY);
@ -1767,7 +1779,7 @@
var selector = Util.getSelectorFromElement(element); var selector = Util.getSelectorFromElement(element);
if (selector) { if (selector) {
parent = $$$1(selector)[0]; parent = document.querySelector(selector);
} }
return parent || element.parentNode; return parent || element.parentNode;
@ -1799,7 +1811,7 @@
if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
if (event.which === ESCAPE_KEYCODE) { if (event.which === ESCAPE_KEYCODE) {
var toggle = $$$1(parent).find(Selector.DATA_TOGGLE)[0]; var toggle = parent.querySelector(Selector.DATA_TOGGLE);
$$$1(toggle).trigger('focus'); $$$1(toggle).trigger('focus');
} }
@ -1807,7 +1819,7 @@
return; return;
} }
var items = $$$1(parent).find(Selector.VISIBLE_ITEMS).get(); var items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS));
if (items.length === 0) { if (items.length === 0) {
return; return;
@ -1957,7 +1969,7 @@
function Modal(element, config) { function Modal(element, config) {
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._element = element; this._element = element;
this._dialog = $$$1(element).find(Selector.DIALOG)[0]; this._dialog = element.querySelector(Selector.DIALOG);
this._backdrop = null; this._backdrop = null;
this._isShown = false; this._isShown = false;
this._isBodyOverflowing = false; this._isBodyOverflowing = false;
@ -2214,7 +2226,7 @@
this._backdrop.className = ClassName.BACKDROP; this._backdrop.className = ClassName.BACKDROP;
if (animate) { if (animate) {
$$$1(this._backdrop).addClass(animate); this._backdrop.classList.add(animate);
} }
$$$1(this._backdrop).appendTo(document.body); $$$1(this._backdrop).appendTo(document.body);
@ -2308,21 +2320,24 @@
if (this._isBodyOverflowing) { if (this._isBodyOverflowing) {
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
// Adjust fixed content padding var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
$$$1(Selector.FIXED_CONTENT).each(function (index, element) { var stickyContent = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT));
var actualPadding = $$$1(element)[0].style.paddingRight; var navbarToggler = [].slice.call(document.querySelectorAll(Selector.NAVBAR_TOGGLER)); // Adjust fixed content padding
$$$1(fixedContent).each(function (index, element) {
var actualPadding = element.style.paddingRight;
var calculatedPadding = $$$1(element).css('padding-right'); var calculatedPadding = $$$1(element).css('padding-right');
$$$1(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); $$$1(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
}); // Adjust sticky content margin }); // Adjust sticky content margin
$$$1(Selector.STICKY_CONTENT).each(function (index, element) { $$$1(stickyContent).each(function (index, element) {
var actualMargin = $$$1(element)[0].style.marginRight; var actualMargin = element.style.marginRight;
var calculatedMargin = $$$1(element).css('margin-right'); var calculatedMargin = $$$1(element).css('margin-right');
$$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); $$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
}); // Adjust navbar-toggler margin }); // Adjust navbar-toggler margin
$$$1(Selector.NAVBAR_TOGGLER).each(function (index, element) { $$$1(navbarToggler).each(function (index, element) {
var actualMargin = $$$1(element)[0].style.marginRight; var actualMargin = element.style.marginRight;
var calculatedMargin = $$$1(element).css('margin-right'); var calculatedMargin = $$$1(element).css('margin-right');
$$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + "px"); $$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + "px");
}); // Adjust body padding }); // Adjust body padding
@ -2335,7 +2350,8 @@
_proto._resetScrollbar = function _resetScrollbar() { _proto._resetScrollbar = function _resetScrollbar() {
// Restore fixed content padding // Restore fixed content padding
$$$1(Selector.FIXED_CONTENT).each(function (index, element) { var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
$$$1(fixedContent).each(function (index, element) {
var padding = $$$1(element).data('padding-right'); var padding = $$$1(element).data('padding-right');
if (typeof padding !== 'undefined') { if (typeof padding !== 'undefined') {
@ -2343,7 +2359,8 @@
} }
}); // Restore sticky content and navbar-toggler margin }); // Restore sticky content and navbar-toggler margin
$$$1(Selector.STICKY_CONTENT + ", " + Selector.NAVBAR_TOGGLER).each(function (index, element) { var elements = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT + ", " + Selector.NAVBAR_TOGGLER));
$$$1(elements).each(function (index, element) {
var margin = $$$1(element).data('margin-right'); var margin = $$$1(element).data('margin-right');
if (typeof margin !== 'undefined') { if (typeof margin !== 'undefined') {
@ -2420,7 +2437,7 @@
var selector = Util.getSelectorFromElement(this); var selector = Util.getSelectorFromElement(this);
if (selector) { if (selector) {
target = $$$1(selector)[0]; target = document.querySelector(selector);
} }
var config = $$$1(target).data(DATA_KEY) ? 'toggle' : _objectSpread({}, $$$1(target).data(), $$$1(this).data()); var config = $$$1(target).data(DATA_KEY) ? 'toggle' : _objectSpread({}, $$$1(target).data(), $$$1(this).data());
@ -2685,7 +2702,7 @@
var attachment = this._getAttachment(placement); var attachment = this._getAttachment(placement);
this.addAttachmentClass(attachment); this.addAttachmentClass(attachment);
var container = this.config.container === false ? document.body : $$$1(this.config.container); var container = this.config.container === false ? document.body : $$$1(document).find(this.config.container);
$$$1(tip).data(this.constructor.DATA_KEY, this); $$$1(tip).data(this.constructor.DATA_KEY, this);
if (!$$$1.contains(this.element.ownerDocument.documentElement, this.tip)) { if (!$$$1.contains(this.element.ownerDocument.documentElement, this.tip)) {
@ -2824,9 +2841,9 @@
}; };
_proto.setContent = function setContent() { _proto.setContent = function setContent() {
var $tip = $$$1(this.getTipElement()); var tip = this.getTipElement();
this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()); this.setElementContent($$$1(tip.querySelectorAll(Selector.TOOLTIP_INNER)), this.getTitle());
$tip.removeClass(ClassName.FADE + " " + ClassName.SHOW); $$$1(tip).removeClass(ClassName.FADE + " " + ClassName.SHOW);
}; };
_proto.setElementContent = function setElementContent($element, content) { _proto.setElementContent = function setElementContent($element, content) {
@ -3019,7 +3036,7 @@
var $tip = $$$1(this.getTipElement()); var $tip = $$$1(this.getTipElement());
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
if (tabClass !== null && tabClass.length > 0) { if (tabClass !== null && tabClass.length) {
$tip.removeClass(tabClass.join('')); $tip.removeClass(tabClass.join(''));
} }
}; };
@ -3421,13 +3438,13 @@
this._offsets = []; this._offsets = [];
this._targets = []; this._targets = [];
this._scrollHeight = this._getScrollHeight(); this._scrollHeight = this._getScrollHeight();
var targets = $$$1.makeArray($$$1(this._selector)); var targets = [].slice.call(document.querySelectorAll(this._selector));
targets.map(function (element) { targets.map(function (element) {
var target; var target;
var targetSelector = Util.getSelectorFromElement(element); var targetSelector = Util.getSelectorFromElement(element);
if (targetSelector) { if (targetSelector) {
target = $$$1(targetSelector)[0]; target = document.querySelector(targetSelector);
} }
if (target) { if (target) {
@ -3524,7 +3541,9 @@
return; return;
} }
for (var i = this._offsets.length; i--;) { var offsetLength = this._offsets.length;
for (var i = offsetLength; i--;) {
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
if (isActiveTarget) { if (isActiveTarget) {
@ -3544,7 +3563,7 @@
queries = queries.map(function (selector) { queries = queries.map(function (selector) {
return selector + "[data-target=\"" + target + "\"]," + (selector + "[href=\"" + target + "\"]"); return selector + "[data-target=\"" + target + "\"]," + (selector + "[href=\"" + target + "\"]");
}); });
var $link = $$$1(queries.join(',')); var $link = $$$1([].slice.call(document.querySelectorAll(queries.join(','))));
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
@ -3565,7 +3584,8 @@
}; };
_proto._clear = function _clear() { _proto._clear = function _clear() {
$$$1(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE); var nodes = [].slice.call(document.querySelectorAll(this._selector));
$$$1(nodes).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
}; // Static }; // Static
@ -3612,9 +3632,10 @@
$$$1(window).on(Event.LOAD_DATA_API, function () { $$$1(window).on(Event.LOAD_DATA_API, function () {
var scrollSpys = $$$1.makeArray($$$1(Selector.DATA_SPY)); var scrollSpys = [].slice.call(document.querySelectorAll(Selector.DATA_SPY));
var scrollSpysLength = scrollSpys.length;
for (var i = scrollSpys.length; i--;) { for (var i = scrollSpysLength; i--;) {
var $spy = $$$1(scrollSpys[i]); var $spy = $$$1(scrollSpys[i]);
ScrollSpy._jQueryInterface.call($spy, $spy.data()); ScrollSpy._jQueryInterface.call($spy, $spy.data());
@ -3733,7 +3754,7 @@
} }
if (selector) { if (selector) {
target = $$$1(selector)[0]; target = document.querySelector(selector);
} }
this._activate(this._element, listElement); this._activate(this._element, listElement);
@ -3815,7 +3836,8 @@
var dropdownElement = $$$1(element).closest(Selector.DROPDOWN)[0]; var dropdownElement = $$$1(element).closest(Selector.DROPDOWN)[0];
if (dropdownElement) { if (dropdownElement) {
$$$1(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector.DROPDOWN_TOGGLE));
$$$1(dropdownToggleList).addClass(ClassName.ACTIVE);
} }
element.setAttribute('aria-expanded', true); element.setAttribute('aria-expanded', true);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
js/dist/alert.js vendored
View file

@ -78,7 +78,7 @@ var Alert = function ($) {
var parent = false; var parent = false;
if (selector) { if (selector) {
parent = $(selector)[0]; parent = document.querySelector(selector);
} }
if (!parent) { if (!parent) {

File diff suppressed because one or more lines are too long

10
js/dist/button.js vendored
View file

@ -60,14 +60,14 @@ var Button = function ($) {
var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0]; var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
if (rootElement) { if (rootElement) {
var input = $(this._element).find(Selector.INPUT)[0]; var input = this._element.querySelector(Selector.INPUT);
if (input) { if (input) {
if (input.type === 'radio') { if (input.type === 'radio') {
if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) { if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) {
triggerChangeEvent = false; triggerChangeEvent = false;
} else { } else {
var activeElement = $(rootElement).find(Selector.ACTIVE)[0]; var activeElement = rootElement.querySelector(Selector.ACTIVE);
if (activeElement) { if (activeElement) {
$(activeElement).removeClass(ClassName.ACTIVE); $(activeElement).removeClass(ClassName.ACTIVE);
@ -80,7 +80,7 @@ var Button = function ($) {
return; return;
} }
input.checked = !$(this._element).hasClass(ClassName.ACTIVE); input.checked = !this._element.classList.contains(ClassName.ACTIVE);
$(input).trigger('change'); $(input).trigger('change');
} }
@ -90,7 +90,7 @@ var Button = function ($) {
} }
if (addAriaPressed) { if (addAriaPressed) {
this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE)); this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName.ACTIVE));
} }
if (triggerChangeEvent) { if (triggerChangeEvent) {

File diff suppressed because one or more lines are too long

23
js/dist/carousel.js vendored
View file

@ -98,7 +98,7 @@ var Carousel = function ($) {
this.touchTimeout = null; this.touchTimeout = null;
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._element = $(element)[0]; this._element = $(element)[0];
this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0]; this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
this._addEventListeners(); this._addEventListeners();
} // Getters } // Getters
@ -132,7 +132,7 @@ var Carousel = function ($) {
this._isPaused = true; this._isPaused = true;
} }
if ($(this._element).find(Selector.NEXT_PREV)[0]) { if (this._element.querySelector(Selector.NEXT_PREV)) {
Util.triggerTransitionEnd(this._element); Util.triggerTransitionEnd(this._element);
this.cycle(true); this.cycle(true);
} }
@ -159,7 +159,7 @@ var Carousel = function ($) {
_proto.to = function to(index) { _proto.to = function to(index) {
var _this = this; var _this = this;
this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
var activeIndex = this._getItemIndex(this._activeElement); var activeIndex = this._getItemIndex(this._activeElement);
@ -265,7 +265,7 @@ var Carousel = function ($) {
}; };
_proto._getItemIndex = function _getItemIndex(element) { _proto._getItemIndex = function _getItemIndex(element) {
this._items = $.makeArray($(element).parent().find(Selector.ITEM)); this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
return this._items.indexOf(element); return this._items.indexOf(element);
}; };
@ -290,7 +290,7 @@ var Carousel = function ($) {
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
var targetIndex = this._getItemIndex(relatedTarget); var targetIndex = this._getItemIndex(relatedTarget);
var fromIndex = this._getItemIndex($(this._element).find(Selector.ACTIVE_ITEM)[0]); var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
var slideEvent = $.Event(Event.SLIDE, { var slideEvent = $.Event(Event.SLIDE, {
relatedTarget: relatedTarget, relatedTarget: relatedTarget,
@ -304,7 +304,8 @@ var Carousel = function ($) {
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
if (this._indicatorsElement) { if (this._indicatorsElement) {
$(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE); var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
$(indicators).removeClass(ClassName.ACTIVE);
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
@ -317,7 +318,7 @@ var Carousel = function ($) {
_proto._slide = function _slide(direction, element) { _proto._slide = function _slide(direction, element) {
var _this3 = this; var _this3 = this;
var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
var activeElementIndex = this._getItemIndex(activeElement); var activeElementIndex = this._getItemIndex(activeElement);
@ -483,11 +484,13 @@ var Carousel = function ($) {
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler); $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
$(window).on(Event.LOAD_DATA_API, function () { $(window).on(Event.LOAD_DATA_API, function () {
$(Selector.DATA_RIDE).each(function () { var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
var $carousel = $(this);
for (var i = 0, len = carousels.length; i < len; i++) {
var $carousel = $(carousels[i]);
Carousel._jQueryInterface.call($carousel, $carousel.data()); Carousel._jQueryInterface.call($carousel, $carousel.data());
}); }
}); });
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------

File diff suppressed because one or more lines are too long

38
js/dist/collapse.js vendored
View file

@ -67,14 +67,17 @@ var Collapse = function ($) {
this._isTransitioning = false; this._isTransitioning = false;
this._element = element; this._element = element;
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._triggerArray = $.makeArray($("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); this._triggerArray = $.makeArray(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
var tabToggles = $(Selector.DATA_TOGGLE); var toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
for (var i = 0; i < tabToggles.length; i++) { for (var i = 0, len = toggleList.length; i < len; i++) {
var elem = tabToggles[i]; var elem = toggleList[i];
var selector = Util.getSelectorFromElement(elem); var selector = Util.getSelectorFromElement(elem);
var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
return foundElem === element;
});
if (selector !== null && $(selector).filter(element).length > 0) { if (selector !== null && filterElement.length > 0) {
this._selector = selector; this._selector = selector;
this._triggerArray.push(elem); this._triggerArray.push(elem);
@ -115,7 +118,9 @@ var Collapse = function ($) {
var activesData; var activesData;
if (this._parent) { if (this._parent) {
actives = $.makeArray($(this._parent).find(Selector.ACTIVES).filter("[data-parent=\"" + this._config.parent + "\"]")); actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES)).filter(function (elem) {
return elem.getAttribute('data-parent') === _this._config.parent;
});
if (actives.length === 0) { if (actives.length === 0) {
actives = null; actives = null;
@ -150,7 +155,7 @@ var Collapse = function ($) {
$(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING); $(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
this._element.style[dimension] = 0; this._element.style[dimension] = 0;
if (this._triggerArray.length > 0) { if (this._triggerArray.length) {
$(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true); $(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
} }
@ -191,14 +196,15 @@ var Collapse = function ($) {
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
Util.reflow(this._element); Util.reflow(this._element);
$(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW); $(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
var triggerArrayLength = this._triggerArray.length;
if (this._triggerArray.length > 0) { if (triggerArrayLength > 0) {
for (var i = 0; i < this._triggerArray.length; i++) { for (var i = 0; i < triggerArrayLength; i++) {
var trigger = this._triggerArray[i]; var trigger = this._triggerArray[i];
var selector = Util.getSelectorFromElement(trigger); var selector = Util.getSelectorFromElement(trigger);
if (selector !== null) { if (selector !== null) {
var $elem = $(selector); var $elem = $([].slice.call(document.querySelectorAll(selector)));
if (!$elem.hasClass(ClassName.SHOW)) { if (!$elem.hasClass(ClassName.SHOW)) {
$(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false); $(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
@ -259,11 +265,12 @@ var Collapse = function ($) {
parent = this._config.parent[0]; parent = this._config.parent[0];
} }
} else { } else {
parent = $(this._config.parent)[0]; parent = document.querySelector(this._config.parent);
} }
var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
$(parent).find(selector).each(function (i, element) { var children = [].slice.call(parent.querySelectorAll(selector));
$(children).each(function (i, element) {
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
}); });
return parent; return parent;
@ -273,7 +280,7 @@ var Collapse = function ($) {
if (element) { if (element) {
var isOpen = $(element).hasClass(ClassName.SHOW); var isOpen = $(element).hasClass(ClassName.SHOW);
if (triggerArray.length > 0) { if (triggerArray.length) {
$(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); $(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
} }
} }
@ -282,7 +289,7 @@ var Collapse = function ($) {
Collapse._getTargetFromElement = function _getTargetFromElement(element) { Collapse._getTargetFromElement = function _getTargetFromElement(element) {
var selector = Util.getSelectorFromElement(element); var selector = Util.getSelectorFromElement(element);
return selector ? $(selector)[0] : null; return selector ? document.querySelector(selector) : null;
}; };
Collapse._jQueryInterface = function _jQueryInterface(config) { Collapse._jQueryInterface = function _jQueryInterface(config) {
@ -340,7 +347,8 @@ var Collapse = function ($) {
var $trigger = $(this); var $trigger = $(this);
var selector = Util.getSelectorFromElement(this); var selector = Util.getSelectorFromElement(this);
$(selector).each(function () { var selectors = [].slice.call(document.querySelectorAll(selector));
$(selectors).each(function () {
var $target = $(this); var $target = $(this);
var data = $target.data(DATA_KEY); var data = $target.data(DATA_KEY);
var config = data ? 'toggle' : $trigger.data(); var config = data ? 'toggle' : $trigger.data();

File diff suppressed because one or more lines are too long

16
js/dist/dropdown.js vendored
View file

@ -228,14 +228,16 @@ var Dropdown = function ($) {
if (!this._menu) { if (!this._menu) {
var parent = Dropdown._getParentFromElement(this._element); var parent = Dropdown._getParentFromElement(this._element);
this._menu = $(parent).find(Selector.MENU)[0]; if (parent) {
this._menu = parent.querySelector(Selector.MENU);
}
} }
return this._menu; return this._menu;
}; };
_proto._getPlacement = function _getPlacement() { _proto._getPlacement = function _getPlacement() {
var $parentDropdown = $(this._element).parent(); var $parentDropdown = $(this._element.parentNode);
var placement = AttachmentMap.BOTTOM; // Handle dropup var placement = AttachmentMap.BOTTOM; // Handle dropup
if ($parentDropdown.hasClass(ClassName.DROPUP)) { if ($parentDropdown.hasClass(ClassName.DROPUP)) {
@ -323,9 +325,9 @@ var Dropdown = function ($) {
return; return;
} }
var toggles = $.makeArray($(Selector.DATA_TOGGLE)); var toggles = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
for (var i = 0; i < toggles.length; i++) { for (var i = 0, len = toggles.length; i < len; i++) {
var parent = Dropdown._getParentFromElement(toggles[i]); var parent = Dropdown._getParentFromElement(toggles[i]);
var context = $(toggles[i]).data(DATA_KEY); var context = $(toggles[i]).data(DATA_KEY);
@ -371,7 +373,7 @@ var Dropdown = function ($) {
var selector = Util.getSelectorFromElement(element); var selector = Util.getSelectorFromElement(element);
if (selector) { if (selector) {
parent = $(selector)[0]; parent = document.querySelector(selector);
} }
return parent || element.parentNode; return parent || element.parentNode;
@ -403,7 +405,7 @@ var Dropdown = function ($) {
if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
if (event.which === ESCAPE_KEYCODE) { if (event.which === ESCAPE_KEYCODE) {
var toggle = $(parent).find(Selector.DATA_TOGGLE)[0]; var toggle = parent.querySelector(Selector.DATA_TOGGLE);
$(toggle).trigger('focus'); $(toggle).trigger('focus');
} }
@ -411,7 +413,7 @@ var Dropdown = function ($) {
return; return;
} }
var items = $(parent).find(Selector.VISIBLE_ITEMS).get(); var items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS));
if (items.length === 0) { if (items.length === 0) {
return; return;

File diff suppressed because one or more lines are too long

29
js/dist/modal.js vendored
View file

@ -79,7 +79,7 @@ var Modal = function ($) {
function Modal(element, config) { function Modal(element, config) {
this._config = this._getConfig(config); this._config = this._getConfig(config);
this._element = element; this._element = element;
this._dialog = $(element).find(Selector.DIALOG)[0]; this._dialog = element.querySelector(Selector.DIALOG);
this._backdrop = null; this._backdrop = null;
this._isShown = false; this._isShown = false;
this._isBodyOverflowing = false; this._isBodyOverflowing = false;
@ -336,7 +336,7 @@ var Modal = function ($) {
this._backdrop.className = ClassName.BACKDROP; this._backdrop.className = ClassName.BACKDROP;
if (animate) { if (animate) {
$(this._backdrop).addClass(animate); this._backdrop.classList.add(animate);
} }
$(this._backdrop).appendTo(document.body); $(this._backdrop).appendTo(document.body);
@ -430,21 +430,24 @@ var Modal = function ($) {
if (this._isBodyOverflowing) { if (this._isBodyOverflowing) {
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
// Adjust fixed content padding var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
$(Selector.FIXED_CONTENT).each(function (index, element) { var stickyContent = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT));
var actualPadding = $(element)[0].style.paddingRight; var navbarToggler = [].slice.call(document.querySelectorAll(Selector.NAVBAR_TOGGLER)); // Adjust fixed content padding
$(fixedContent).each(function (index, element) {
var actualPadding = element.style.paddingRight;
var calculatedPadding = $(element).css('padding-right'); var calculatedPadding = $(element).css('padding-right');
$(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
}); // Adjust sticky content margin }); // Adjust sticky content margin
$(Selector.STICKY_CONTENT).each(function (index, element) { $(stickyContent).each(function (index, element) {
var actualMargin = $(element)[0].style.marginRight; var actualMargin = element.style.marginRight;
var calculatedMargin = $(element).css('margin-right'); var calculatedMargin = $(element).css('margin-right');
$(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
}); // Adjust navbar-toggler margin }); // Adjust navbar-toggler margin
$(Selector.NAVBAR_TOGGLER).each(function (index, element) { $(navbarToggler).each(function (index, element) {
var actualMargin = $(element)[0].style.marginRight; var actualMargin = element.style.marginRight;
var calculatedMargin = $(element).css('margin-right'); var calculatedMargin = $(element).css('margin-right');
$(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + "px"); $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + "px");
}); // Adjust body padding }); // Adjust body padding
@ -457,7 +460,8 @@ var Modal = function ($) {
_proto._resetScrollbar = function _resetScrollbar() { _proto._resetScrollbar = function _resetScrollbar() {
// Restore fixed content padding // Restore fixed content padding
$(Selector.FIXED_CONTENT).each(function (index, element) { var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
$(fixedContent).each(function (index, element) {
var padding = $(element).data('padding-right'); var padding = $(element).data('padding-right');
if (typeof padding !== 'undefined') { if (typeof padding !== 'undefined') {
@ -465,7 +469,8 @@ var Modal = function ($) {
} }
}); // Restore sticky content and navbar-toggler margin }); // Restore sticky content and navbar-toggler margin
$(Selector.STICKY_CONTENT + ", " + Selector.NAVBAR_TOGGLER).each(function (index, element) { var elements = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT + ", " + Selector.NAVBAR_TOGGLER));
$(elements).each(function (index, element) {
var margin = $(element).data('margin-right'); var margin = $(element).data('margin-right');
if (typeof margin !== 'undefined') { if (typeof margin !== 'undefined') {
@ -542,7 +547,7 @@ var Modal = function ($) {
var selector = Util.getSelectorFromElement(this); var selector = Util.getSelectorFromElement(this);
if (selector) { if (selector) {
target = $(selector)[0]; target = document.querySelector(selector);
} }
var config = $(target).data(DATA_KEY) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data()); var config = $(target).data(DATA_KEY) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data());

File diff suppressed because one or more lines are too long

18
js/dist/scrollspy.js vendored
View file

@ -101,13 +101,13 @@ var ScrollSpy = function ($) {
this._offsets = []; this._offsets = [];
this._targets = []; this._targets = [];
this._scrollHeight = this._getScrollHeight(); this._scrollHeight = this._getScrollHeight();
var targets = $.makeArray($(this._selector)); var targets = [].slice.call(document.querySelectorAll(this._selector));
targets.map(function (element) { targets.map(function (element) {
var target; var target;
var targetSelector = Util.getSelectorFromElement(element); var targetSelector = Util.getSelectorFromElement(element);
if (targetSelector) { if (targetSelector) {
target = $(targetSelector)[0]; target = document.querySelector(targetSelector);
} }
if (target) { if (target) {
@ -204,7 +204,9 @@ var ScrollSpy = function ($) {
return; return;
} }
for (var i = this._offsets.length; i--;) { var offsetLength = this._offsets.length;
for (var i = offsetLength; i--;) {
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
if (isActiveTarget) { if (isActiveTarget) {
@ -224,7 +226,7 @@ var ScrollSpy = function ($) {
queries = queries.map(function (selector) { queries = queries.map(function (selector) {
return selector + "[data-target=\"" + target + "\"]," + (selector + "[href=\"" + target + "\"]"); return selector + "[data-target=\"" + target + "\"]," + (selector + "[href=\"" + target + "\"]");
}); });
var $link = $(queries.join(',')); var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
@ -245,7 +247,8 @@ var ScrollSpy = function ($) {
}; };
_proto._clear = function _clear() { _proto._clear = function _clear() {
$(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE); var nodes = [].slice.call(document.querySelectorAll(this._selector));
$(nodes).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
}; // Static }; // Static
@ -292,9 +295,10 @@ var ScrollSpy = function ($) {
$(window).on(Event.LOAD_DATA_API, function () { $(window).on(Event.LOAD_DATA_API, function () {
var scrollSpys = $.makeArray($(Selector.DATA_SPY)); var scrollSpys = [].slice.call(document.querySelectorAll(Selector.DATA_SPY));
var scrollSpysLength = scrollSpys.length;
for (var i = scrollSpys.length; i--;) { for (var i = scrollSpysLength; i--;) {
var $spy = $(scrollSpys[i]); var $spy = $(scrollSpys[i]);
ScrollSpy._jQueryInterface.call($spy, $spy.data()); ScrollSpy._jQueryInterface.call($spy, $spy.data());

File diff suppressed because one or more lines are too long

5
js/dist/tab.js vendored
View file

@ -97,7 +97,7 @@ var Tab = function ($) {
} }
if (selector) { if (selector) {
target = $(selector)[0]; target = document.querySelector(selector);
} }
this._activate(this._element, listElement); this._activate(this._element, listElement);
@ -179,7 +179,8 @@ var Tab = function ($) {
var dropdownElement = $(element).closest(Selector.DROPDOWN)[0]; var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
if (dropdownElement) { if (dropdownElement) {
$(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector.DROPDOWN_TOGGLE));
$(dropdownToggleList).addClass(ClassName.ACTIVE);
} }
element.setAttribute('aria-expanded', true); element.setAttribute('aria-expanded', true);

2
js/dist/tab.js.map vendored

File diff suppressed because one or more lines are too long

10
js/dist/tooltip.js vendored
View file

@ -229,7 +229,7 @@ var Tooltip = function ($) {
var attachment = this._getAttachment(placement); var attachment = this._getAttachment(placement);
this.addAttachmentClass(attachment); this.addAttachmentClass(attachment);
var container = this.config.container === false ? document.body : $(this.config.container); var container = this.config.container === false ? document.body : $(document).find(this.config.container);
$(tip).data(this.constructor.DATA_KEY, this); $(tip).data(this.constructor.DATA_KEY, this);
if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
@ -368,9 +368,9 @@ var Tooltip = function ($) {
}; };
_proto.setContent = function setContent() { _proto.setContent = function setContent() {
var $tip = $(this.getTipElement()); var tip = this.getTipElement();
this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()); this.setElementContent($(tip.querySelectorAll(Selector.TOOLTIP_INNER)), this.getTitle());
$tip.removeClass(ClassName.FADE + " " + ClassName.SHOW); $(tip).removeClass(ClassName.FADE + " " + ClassName.SHOW);
}; };
_proto.setElementContent = function setElementContent($element, content) { _proto.setElementContent = function setElementContent($element, content) {
@ -563,7 +563,7 @@ var Tooltip = function ($) {
var $tip = $(this.getTipElement()); var $tip = $(this.getTipElement());
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
if (tabClass !== null && tabClass.length > 0) { if (tabClass !== null && tabClass.length) {
$tip.removeClass(tabClass.join('')); $tip.removeClass(tabClass.join(''));
} }
}; };

File diff suppressed because one or more lines are too long

3
js/dist/util.js vendored
View file

@ -76,8 +76,7 @@ var Util = function ($) {
} }
try { try {
var $selector = $(document).find(selector); return document.querySelector(selector) ? selector : null;
return $selector.length > 0 ? selector : null;
} catch (err) { } catch (err) {
return null; return null;
} }

2
js/dist/util.js.map vendored

File diff suppressed because one or more lines are too long