1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-07 22:26:57 +02:00

Add Tests on scrollbar.js & better handling if a style property doesn't exists (#33948)

* scrollbar.js:
add some tests
transfer test from modal.spec. to scrollbar.spec
proper handling if style property doesn't exist
This commit is contained in:
GeoSot
2021-05-20 16:29:04 +03:00
committed by GitHub
parent 9e4f87ae8f
commit 79c3bf47bc
3 changed files with 127 additions and 245 deletions

View File

@@ -44,8 +44,11 @@ const _setElementAttributes = (selector, styleProp, callback) => {
}
const actualValue = element.style[styleProp]
if (actualValue) {
Manipulator.setDataAttribute(element, styleProp, actualValue)
}
const calculatedValue = window.getComputedStyle(element)[styleProp]
Manipulator.setDataAttribute(element, styleProp, actualValue)
element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`
})
}