mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-08 06:36:33 +02:00
Get only bs prefixed data attributes
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user