From e530118117af509ffb97029cd250a23ee08120b6 Mon Sep 17 00:00:00 2001 From: Rohit Sharma Date: Wed, 11 Nov 2020 12:07:04 +0530 Subject: Get only bs prefixed data attributes --- js/src/dom/manipulator.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'js/src') 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 -- cgit v1.2.3