diff options
| author | Rohit Sharma <[email protected]> | 2020-11-11 12:07:04 +0530 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2020-11-14 07:09:15 +0200 |
| commit | e530118117af509ffb97029cd250a23ee08120b6 (patch) | |
| tree | bb541e3d3c692df4391359001a7e679c146bb14c /js/src | |
| parent | a7f04e9595205ed091a5bba71cedc4a80fc4da47 (diff) | |
| download | bootstrap-e530118117af509ffb97029cd250a23ee08120b6.tar.xz bootstrap-e530118117af509ffb97029cd250a23ee08120b6.zip | |
Get only bs prefixed data attributes
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/dom/manipulator.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/js/src/dom/manipulator.js b/js/src/dom/manipulator.js index 04b9543c8..faab54b5e 100644 --- a/js/src/dom/manipulator.js +++ b/js/src/dom/manipulator.js @@ -43,16 +43,14 @@ const Manipulator = { return {} } - const attributes = { - ...element.dataset - } + const attributes = {} - Object.keys(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(attributes[key]) + attributes[pureKey] = normalizeData(element.dataset[key]) }) return attributes |
