diff options
| author | Bobby <[email protected]> | 2024-08-16 20:47:33 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-08-16 20:47:33 -0400 |
| commit | 6b28433d9cfde435be8ec2bd6cf91e6324d08865 (patch) | |
| tree | 8343c27b8b95ff5639233e81cf157f92e5688466 /js/dist/dom/data.js | |
| parent | d53094ec16ba385faae2973ddee648698b32ab24 (diff) | |
| parent | 048f56f51460df75e92a2f7b472e1c56baeb68f7 (diff) | |
| download | bootstrap-main.tar.xz bootstrap-main.zip | |
Diffstat (limited to 'js/dist/dom/data.js')
| -rw-r--r-- | js/dist/dom/data.js | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/js/dist/dom/data.js b/js/dist/dom/data.js index f8dafc699..23d4cb9cd 100644 --- a/js/dist/dom/data.js +++ b/js/dist/dom/data.js @@ -1,6 +1,6 @@ /*! - * Bootstrap data.js v5.1.3 (https://getbootstrap.com/) - * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Bootstrap data.js v5.3.3 (https://getbootstrap.com/) + * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { @@ -11,56 +11,50 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.3): dom/data.js + * Bootstrap dom/data.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** - * ------------------------------------------------------------------------ * Constants - * ------------------------------------------------------------------------ */ + const elementMap = new Map(); const data = { set(element, key, instance) { if (!elementMap.has(element)) { elementMap.set(element, new Map()); } + const instanceMap = elementMap.get(element); - const instanceMap = elementMap.get(element); // make it clear we only want one instance per element + // make it clear we only want one instance per element // can be removed later when multiple key/instances are fine to be used - if (!instanceMap.has(key) && instanceMap.size !== 0) { // eslint-disable-next-line no-console console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); return; } - instanceMap.set(key, instance); }, - get(element, key) { if (elementMap.has(element)) { return elementMap.get(element).get(key) || null; } - return null; }, - remove(element, key) { if (!elementMap.has(element)) { return; } - const instanceMap = elementMap.get(element); - instanceMap.delete(key); // free up element references if there are no instances left for an element + instanceMap.delete(key); + // free up element references if there are no instances left for an element if (instanceMap.size === 0) { elementMap.delete(element); } } - }; return data; |
