source: trip-planner-front/node_modules/bootstrap/js/dist/dom/data.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*!
2 * Bootstrap data.js v5.1.3 (https://getbootstrap.com/)
3 * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5 */
6(function (global, factory) {
7 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
8 typeof define === 'function' && define.amd ? define(factory) :
9 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Data = factory());
10})(this, (function () { 'use strict';
11
12 /**
13 * --------------------------------------------------------------------------
14 * Bootstrap (v5.1.3): dom/data.js
15 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16 * --------------------------------------------------------------------------
17 */
18
19 /**
20 * ------------------------------------------------------------------------
21 * Constants
22 * ------------------------------------------------------------------------
23 */
24 const elementMap = new Map();
25 const data = {
26 set(element, key, instance) {
27 if (!elementMap.has(element)) {
28 elementMap.set(element, new Map());
29 }
30
31 const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
32 // can be removed later when multiple key/instances are fine to be used
33
34 if (!instanceMap.has(key) && instanceMap.size !== 0) {
35 // eslint-disable-next-line no-console
36 console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
37 return;
38 }
39
40 instanceMap.set(key, instance);
41 },
42
43 get(element, key) {
44 if (elementMap.has(element)) {
45 return elementMap.get(element).get(key) || null;
46 }
47
48 return null;
49 },
50
51 remove(element, key) {
52 if (!elementMap.has(element)) {
53 return;
54 }
55
56 const instanceMap = elementMap.get(element);
57 instanceMap.delete(key); // free up element references if there are no instances left for an element
58
59 if (instanceMap.size === 0) {
60 elementMap.delete(element);
61 }
62 }
63
64 };
65
66 return data;
67
68}));
69//# sourceMappingURL=data.js.map
Note: See TracBrowser for help on using the repository browser.