1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-26 21:39:08 +02:00

alert without jquery

This commit is contained in:
Johann-S
2017-08-21 09:11:37 +02:00
committed by XhmikosR
parent 8d34bc136b
commit 0b16c8c6d9
17 changed files with 149 additions and 53 deletions

51
js/src/dom/data.js Normal file
View File

@@ -0,0 +1,51 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-beta): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
const mapData = (() => {
const storeData = {}
return {
set(element, key, data) {
let id
if (element.key === undefined) {
element.key = {
key,
id
}
}
storeData[id] = data
},
get(element, key) {
if (element.key === undefined || element.key !== key) {
return null
}
const keyProperties = element.key
return storeData[keyProperties.id]
},
delete(element, key) {
if (element.key === undefined || element.key !== key) {
return
}
const keyProperties = element.key
delete storeData[keyProperties.id]
}
}
})()
const Data = {
setData(instance, key, data) {
mapData.set(instance, key, data)
},
getData(instance, key) {
mapData.get(instance, key)
},
removeData(instance, key) {
mapData.delete(instance, key)
}
}
export default Data