diff options
author | GeoSot <geo.sotis@gmail.com> | 2021-05-20 16:29:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-20 16:29:04 +0300 |
commit | 79c3bf47bc125fd64cf8cac6cd34b03270d34e2d (patch) | |
tree | 337b0109d9ad0b193abb8e9c80e7b804fd8817bd /js/src | |
parent | 9e4f87ae8f2e32bb31795ece8f9ab3e7b823dd7d (diff) |
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
Diffstat (limited to 'js/src')
-rw-r--r-- | js/src/util/scrollbar.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/js/src/util/scrollbar.js b/js/src/util/scrollbar.js index 98c076f25f..79a3b12c78 100644 --- a/js/src/util/scrollbar.js +++ b/js/src/util/scrollbar.js @@ -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` }) } |