From 79c3bf47bc125fd64cf8cac6cd34b03270d34e2d Mon Sep 17 00:00:00 2001 From: GeoSot Date: Thu, 20 May 2021 16:29:04 +0300 Subject: 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 --- js/src/util/scrollbar.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'js/src/util') 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` }) } -- cgit v1.2.3