diff options
| author | XhmikosR <[email protected]> | 2021-08-18 07:29:56 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-08-18 07:29:56 +0300 |
| commit | 433a148c9e61aa942801fd8101dfa5c4045fdaed (patch) | |
| tree | f41db59fd06019169df5ea0338213ec0e298f226 /js/dist/dom/manipulator.js | |
| parent | b97cfa163b5098db70e03b27c91fca5dde9c267e (diff) | |
| parent | 18b3e1ac71f73d006756684a285c5a818e2d1454 (diff) | |
| download | bootstrap-global-focus-vars.tar.xz bootstrap-global-focus-vars.zip | |
Merge branch 'main' into global-focus-varsglobal-focus-vars
Diffstat (limited to 'js/dist/dom/manipulator.js')
| -rw-r--r-- | js/dist/dom/manipulator.js | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/js/dist/dom/manipulator.js b/js/dist/dom/manipulator.js index 455504f1f..79d9ad382 100644 --- a/js/dist/dom/manipulator.js +++ b/js/dist/dom/manipulator.js @@ -1,5 +1,5 @@ /*! - * Bootstrap manipulator.js v5.0.0-beta2 (https://getbootstrap.com/) + * Bootstrap manipulator.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,7 +11,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.0.0-beta2): dom/manipulator.js + * Bootstrap (v5.1.0): dom/manipulator.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -36,49 +36,51 @@ } function normalizeDataKey(key) { - return key.replace(/[A-Z]/g, function (chr) { - return "-" + chr.toLowerCase(); - }); + return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`); } - var Manipulator = { - setDataAttribute: function setDataAttribute(element, key, value) { - element.setAttribute("data-bs-" + normalizeDataKey(key), value); + const Manipulator = { + setDataAttribute(element, key, value) { + element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value); }, - removeDataAttribute: function removeDataAttribute(element, key) { - element.removeAttribute("data-bs-" + normalizeDataKey(key)); + + removeDataAttribute(element, key) { + element.removeAttribute(`data-bs-${normalizeDataKey(key)}`); }, - getDataAttributes: function getDataAttributes(element) { + + getDataAttributes(element) { if (!element) { return {}; } - var attributes = {}; - Object.keys(element.dataset).filter(function (key) { - return key.startsWith('bs'); - }).forEach(function (key) { - var pureKey = key.replace(/^bs/, ''); + const attributes = {}; + Object.keys(element.dataset).filter(key => key.startsWith('bs')).forEach(key => { + let pureKey = key.replace(/^bs/, ''); pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length); attributes[pureKey] = normalizeData(element.dataset[key]); }); return attributes; }, - getDataAttribute: function getDataAttribute(element, key) { - return normalizeData(element.getAttribute("data-bs-" + normalizeDataKey(key))); + + getDataAttribute(element, key) { + return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)); }, - offset: function offset(element) { - var rect = element.getBoundingClientRect(); + + offset(element) { + const rect = element.getBoundingClientRect(); return { - top: rect.top + document.body.scrollTop, - left: rect.left + document.body.scrollLeft + top: rect.top + window.pageYOffset, + left: rect.left + window.pageXOffset }; }, - position: function position(element) { + + position(element) { return { top: element.offsetTop, left: element.offsetLeft }; } + }; return Manipulator; |
