1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-18 03:11:19 +02:00
This commit is contained in:
XhmikosR
2020-03-28 12:29:08 +02:00
committed by GitHub
parent f761d8e801
commit 74afe149c4
59 changed files with 4462 additions and 4022 deletions

View File

@@ -1,6 +1,6 @@
/*!
* Bootstrap selector-engine.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
(function (global, factory) {
@@ -9,21 +9,6 @@
(global = global || self, global.SelectorEngine = factory(global.Polyfill));
}(this, (function (polyfill_js) { 'use strict';
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.3.1): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var makeArray = function makeArray(nodeList) {
if (!nodeList) {
return [];
}
return [].slice.call(nodeList);
};
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.3.1): dom/selector-engine.js
@@ -39,14 +24,16 @@
var NODE_TEXT = 3;
var SelectorEngine = {
matches: function matches(element, selector) {
return polyfill_js.matches.call(element, selector);
return element.matches(selector);
},
find: function find(selector, element) {
var _ref;
if (element === void 0) {
element = document.documentElement;
}
return polyfill_js.find.call(element, selector);
return (_ref = []).concat.apply(_ref, polyfill_js.find.call(element, selector));
},
findOne: function findOne(selector, element) {
if (element === void 0) {
@@ -56,11 +43,12 @@
return polyfill_js.findOne.call(element, selector);
},
children: function children(element, selector) {
var _this = this;
var _ref2;
var children = (_ref2 = []).concat.apply(_ref2, element.children);
var children = makeArray(element.children);
return children.filter(function (child) {
return _this.matches(child, selector);
return child.matches(selector);
});
},
parents: function parents(element, selector) {
@@ -78,21 +66,33 @@
return parents;
},
closest: function closest(element, selector) {
return polyfill_js.closest.call(element, selector);
return element.closest(selector);
},
prev: function prev(element, selector) {
var siblings = [];
var previous = element.previousSibling;
var previous = element.previousElementSibling;
while (previous && previous.nodeType === Node.ELEMENT_NODE && previous.nodeType !== NODE_TEXT) {
if (this.matches(previous, selector)) {
siblings.push(previous);
while (previous) {
if (previous.matches(selector)) {
return [previous];
}
previous = previous.previousSibling;
previous = previous.previousElementSibling;
}
return siblings;
return [];
},
next: function next(element, selector) {
var next = element.nextElementSibling;
while (next) {
if (this.matches(next, selector)) {
return [next];
}
next = next.nextElementSibling;
}
return [];
}
};