Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2019-05-08 16:11:24 +0300
committerXhmikosR <xhmikosr@gmail.com>2019-05-08 17:26:37 +0300
commit438e01b61c935409adca29cde3dbb66dd119eefd (patch)
tree1d4a88922c8a3169b418be877d837fb671d9e3a8 /js/dist/dom/selector-engine.js
parentdda31bbee6f0190bb38e84f909f23c213040002d (diff)
Rename `eventHandler` and `selectorEngine` files.
Diffstat (limited to 'js/dist/dom/selector-engine.js')
-rw-r--r--js/dist/dom/selector-engine.js283
1 files changed, 283 insertions, 0 deletions
diff --git a/js/dist/dom/selector-engine.js b/js/dist/dom/selector-engine.js
new file mode 100644
index 0000000000..9d02332b20
--- /dev/null
+++ b/js/dist/dom/selector-engine.js
@@ -0,0 +1,283 @@
+/*!
+ * Bootstrap selector-engine.js v4.3.1 (https://getbootstrap.com/)
+ * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global = global || self, global.SelectorEngine = factory());
+}(this, function () { 'use strict';
+
+ /**
+ * --------------------------------------------------------------------------
+ * Bootstrap (v4.3.1): util/index.js
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * --------------------------------------------------------------------------
+ */
+ var MAX_UID = 1000000;
+ var _window = window,
+ jQuery = _window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
+ /**
+ * --------------------------------------------------------------------------
+ * Public Util Api
+ * --------------------------------------------------------------------------
+ */
+
+
+ var getUID = function getUID(prefix) {
+ do {
+ // eslint-disable-next-line no-bitwise
+ prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
+ } while (document.getElementById(prefix));
+
+ return prefix;
+ };
+
+ var makeArray = function makeArray(nodeList) {
+ if (!nodeList) {
+ return [];
+ }
+
+ return [].slice.call(nodeList);
+ };
+
+ /* istanbul ignore file */
+ var _Element$prototype = Element.prototype,
+ matches = _Element$prototype.matches,
+ closest = _Element$prototype.closest;
+ var find = Element.prototype.querySelectorAll;
+ var findOne = Element.prototype.querySelector;
+
+ var createCustomEvent = function createCustomEvent(eventName, params) {
+ var cEvent = new CustomEvent(eventName, params);
+ return cEvent;
+ };
+
+ if (typeof window.CustomEvent !== 'function') {
+ createCustomEvent = function createCustomEvent(eventName, params) {
+ params = params || {
+ bubbles: false,
+ cancelable: false,
+ detail: null
+ };
+ var evt = document.createEvent('CustomEvent');
+ evt.initCustomEvent(eventName, params.bubbles, params.cancelable, params.detail);
+ return evt;
+ };
+ }
+
+ var workingDefaultPrevented = function () {
+ var e = document.createEvent('CustomEvent');
+ e.initEvent('Bootstrap', true, true);
+ e.preventDefault();
+ return e.defaultPrevented;
+ }();
+
+ if (!workingDefaultPrevented) {
+ var origPreventDefault = Event.prototype.preventDefault;
+
+ Event.prototype.preventDefault = function () {
+ if (!this.cancelable) {
+ return;
+ }
+
+ origPreventDefault.call(this);
+ Object.defineProperty(this, 'defaultPrevented', {
+ get: function get() {
+ return true;
+ },
+ configurable: true
+ });
+ };
+ } // MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
+
+
+ var defaultPreventedPreservedOnDispatch = function () {
+ var e = createCustomEvent('Bootstrap', {
+ cancelable: true
+ });
+ var element = document.createElement('div');
+ element.addEventListener('Bootstrap', function () {
+ return null;
+ });
+ e.preventDefault();
+ element.dispatchEvent(e);
+ return e.defaultPrevented;
+ }();
+
+ if (!matches) {
+ matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
+ }
+
+ if (!closest) {
+ closest = function closest(selector) {
+ var element = this;
+
+ do {
+ if (matches.call(element, selector)) {
+ return element;
+ }
+
+ element = element.parentElement || element.parentNode;
+ } while (element !== null && element.nodeType === 1);
+
+ return null;
+ };
+ }
+
+ var scopeSelectorRegex = /:scope\b/;
+
+ var supportScopeQuery = function () {
+ var element = document.createElement('div');
+
+ try {
+ element.querySelectorAll(':scope *');
+ } catch (error) {
+ return false;
+ }
+
+ return true;
+ }();
+
+ if (!supportScopeQuery) {
+ find = function find(selector) {
+ if (!scopeSelectorRegex.test(selector)) {
+ return this.querySelectorAll(selector);
+ }
+
+ var hasId = Boolean(this.id);
+
+ if (!hasId) {
+ this.id = getUID('scope');
+ }
+
+ var nodeList = null;
+
+ try {
+ selector = selector.replace(scopeSelectorRegex, "#" + this.id);
+ nodeList = this.querySelectorAll(selector);
+ } finally {
+ if (!hasId) {
+ this.removeAttribute('id');
+ }
+ }
+
+ return nodeList;
+ };
+
+ findOne = function findOne(selector) {
+ if (!scopeSelectorRegex.test(selector)) {
+ return this.querySelector(selector);
+ }
+
+ var matches = find.call(this, selector);
+
+ if (typeof matches[0] !== 'undefined') {
+ return matches[0];
+ }
+
+ return null;
+ };
+ }
+
+ /**
+ * --------------------------------------------------------------------------
+ * Bootstrap (v4.3.1): dom/selector-engine.js
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * --------------------------------------------------------------------------
+ */
+ /**
+ * ------------------------------------------------------------------------
+ * Constants
+ * ------------------------------------------------------------------------
+ */
+
+ var NODE_TEXT = 3;
+ var SelectorEngine = {
+ matches: function matches$1(element, selector) {
+ return matches.call(element, selector);
+ },
+ find: function find$1(selector, element) {
+ if (element === void 0) {
+ element = document.documentElement;
+ }
+
+ if (typeof selector !== 'string') {
+ return null;
+ }
+
+ return find.call(element, selector);
+ },
+ findOne: function findOne$1(selector, element) {
+ if (element === void 0) {
+ element = document.documentElement;
+ }
+
+ if (typeof selector !== 'string') {
+ return null;
+ }
+
+ return findOne.call(element, selector);
+ },
+ children: function children(element, selector) {
+ var _this = this;
+
+ if (typeof selector !== 'string') {
+ return null;
+ }
+
+ var children = makeArray(element.children);
+ return children.filter(function (child) {
+ return _this.matches(child, selector);
+ });
+ },
+ parents: function parents(element, selector) {
+ if (typeof selector !== 'string') {
+ return null;
+ }
+
+ var parents = [];
+ var ancestor = element.parentNode;
+
+ while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
+ if (this.matches(ancestor, selector)) {
+ parents.push(ancestor);
+ }
+
+ ancestor = ancestor.parentNode;
+ }
+
+ return parents;
+ },
+ closest: function closest$1(element, selector) {
+ if (typeof selector !== 'string') {
+ return null;
+ }
+
+ return closest.call(element, selector);
+ },
+ prev: function prev(element, selector) {
+ if (typeof selector !== 'string') {
+ return null;
+ }
+
+ var siblings = [];
+ var previous = element.previousSibling;
+
+ while (previous && previous.nodeType === Node.ELEMENT_NODE && previous.nodeType !== NODE_TEXT) {
+ if (this.matches(previous, selector)) {
+ siblings.push(previous);
+ }
+
+ previous = previous.previousSibling;
+ }
+
+ return siblings;
+ }
+ };
+
+ return SelectorEngine;
+
+}));
+//# sourceMappingURL=selector-engine.js.map