aboutsummaryrefslogtreecommitdiff
path: root/js/dist/dom/selector-engine.js
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2021-08-04 18:41:51 +0300
committerGitHub <[email protected]>2021-08-04 18:41:51 +0300
commitf20fece3a8cdd0e76a42c2737524b7652bf54d26 (patch)
tree83e62cc954b17a8bc21cd5975bfd88da721793d1 /js/dist/dom/selector-engine.js
parent7fcc2f4d526ff774a0a7de6b624a607e5ba47fb9 (diff)
downloadbootstrap-5.1.0.tar.xz
bootstrap-5.1.0.zip
Prepare v5.1.0. (#34674)v5.1.0
Diffstat (limited to 'js/dist/dom/selector-engine.js')
-rw-r--r--js/dist/dom/selector-engine.js52
1 files changed, 47 insertions, 5 deletions
diff --git a/js/dist/dom/selector-engine.js b/js/dist/dom/selector-engine.js
index de6949b17..1d260dce7 100644
--- a/js/dist/dom/selector-engine.js
+++ b/js/dist/dom/selector-engine.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap selector-engine.js v5.0.2 (https://getbootstrap.com/)
+ * Bootstrap selector-engine.js v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
@@ -11,15 +11,52 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.2): dom/selector-engine.js
+ * Bootstrap (v5.1.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
+ const isElement = obj => {
+ if (!obj || typeof obj !== 'object') {
+ return false;
+ }
+
+ if (typeof obj.jquery !== 'undefined') {
+ obj = obj[0];
+ }
+
+ return typeof obj.nodeType !== 'undefined';
+ };
+
+ const isVisible = element => {
+ if (!isElement(element) || element.getClientRects().length === 0) {
+ return false;
+ }
+
+ return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
+ };
+
+ const isDisabled = element => {
+ if (!element || element.nodeType !== Node.ELEMENT_NODE) {
+ return true;
+ }
+
+ if (element.classList.contains('disabled')) {
+ return true;
+ }
+
+ if (typeof element.disabled !== 'undefined') {
+ return element.disabled;
+ }
+
+ return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
+ };
+
/**
- * ------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------
+ * --------------------------------------------------------------------------
+ * Bootstrap (v5.1.0): dom/selector-engine.js
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
+ * --------------------------------------------------------------------------
*/
const NODE_TEXT = 3;
const SelectorEngine = {
@@ -76,6 +113,11 @@
}
return [];
+ },
+
+ focusableChildren(element) {
+ const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
+ return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
}
};