1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-18 19:31:35 +02:00
This commit is contained in:
XhmikosR
2020-11-23 15:17:16 +02:00
committed by GitHub
parent 21737ed530
commit 3e823e0b75
52 changed files with 422 additions and 410 deletions

View File

@@ -9,8 +9,6 @@
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Manipulator = factory());
}(this, (function () { 'use strict';
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0-alpha3): dom/manipulator.js
@@ -45,25 +43,28 @@
var Manipulator = {
setDataAttribute: function setDataAttribute(element, key, value) {
element.setAttribute("data-" + normalizeDataKey(key), value);
element.setAttribute("data-bs-" + normalizeDataKey(key), value);
},
removeDataAttribute: function removeDataAttribute(element, key) {
element.removeAttribute("data-" + normalizeDataKey(key));
element.removeAttribute("data-bs-" + normalizeDataKey(key));
},
getDataAttributes: function getDataAttributes(element) {
if (!element) {
return {};
}
var attributes = _extends({}, element.dataset);
Object.keys(attributes).forEach(function (key) {
attributes[key] = normalizeData(attributes[key]);
var attributes = {};
Object.keys(element.dataset).filter(function (key) {
return key.startsWith('bs');
}).forEach(function (key) {
var 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-" + normalizeDataKey(key)));
return normalizeData(element.getAttribute("data-bs-" + normalizeDataKey(key)));
},
offset: function offset(element) {
var rect = element.getBoundingClientRect();