From 60e7043df2cf70e668b309e14dc03cc4165e0375 Mon Sep 17 00:00:00 2001 From: Rasmus Nielsen Date: Mon, 14 Sep 2020 13:54:07 +0200 Subject: [PATCH 1/3] update dom.js --- src/utils/dom.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/dom.js b/src/utils/dom.js index cd69ca6ad7e..310c5a92809 100644 --- a/src/utils/dom.js +++ b/src/utils/dom.js @@ -210,8 +210,7 @@ export const removeStyle = (el, prop) => { } // Get an style property value from an element -// Returns `null` if not found -export const getStyle = (el, prop) => (prop && isElement(el) ? el.style[prop] || null : null) +export const getStyle = (el, prop) => (prop && isElement(el) ? el.style[prop] : null) // Return the Bounding Client Rect of an element // Returns `null` if not an element From a3946ff678081162778e3ed166729141089e199c Mon Sep 17 00:00:00 2001 From: Rasmus Nielsen Date: Mon, 14 Sep 2020 14:03:31 +0200 Subject: [PATCH 2/3] update --- src/components/modal/helpers/modal-manager.js | 2 +- src/utils/dom.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/modal/helpers/modal-manager.js b/src/components/modal/helpers/modal-manager.js index 3c3a3c4d325..3a1ba7cb8f4 100644 --- a/src/components/modal/helpers/modal-manager.js +++ b/src/components/modal/helpers/modal-manager.js @@ -181,7 +181,7 @@ const ModalManager = /*#__PURE__*/ Vue.extend({ body._marginChangedForModal.push(el) }) // Adjust body padding - const actualPadding = getStyle(body, 'paddingRight') + const actualPadding = getStyle(body, 'paddingRight') || '' setAttr(body, 'data-padding-right', actualPadding) setStyle(body, 'paddingRight', `${toFloat(getCS(body).paddingRight, 0) + scrollbarWidth}px`) } diff --git a/src/utils/dom.js b/src/utils/dom.js index 310c5a92809..cd69ca6ad7e 100644 --- a/src/utils/dom.js +++ b/src/utils/dom.js @@ -210,7 +210,8 @@ export const removeStyle = (el, prop) => { } // Get an style property value from an element -export const getStyle = (el, prop) => (prop && isElement(el) ? el.style[prop] : null) +// Returns `null` if not found +export const getStyle = (el, prop) => (prop && isElement(el) ? el.style[prop] || null : null) // Return the Bounding Client Rect of an element // Returns `null` if not an element From 96fc1c0615f816be33384630331176931283a5d0 Mon Sep 17 00:00:00 2001 From: Rasmus Nielsen Date: Mon, 14 Sep 2020 14:09:00 +0200 Subject: [PATCH 3/3] update modal-manager.js --- src/components/modal/helpers/modal-manager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/modal/helpers/modal-manager.js b/src/components/modal/helpers/modal-manager.js index 3a1ba7cb8f4..0d9b2a2f04c 100644 --- a/src/components/modal/helpers/modal-manager.js +++ b/src/components/modal/helpers/modal-manager.js @@ -159,7 +159,7 @@ const ModalManager = /*#__PURE__*/ Vue.extend({ // Adjust fixed content padding /* istanbul ignore next: difficult to test in JSDOM */ selectAll(Selector.FIXED_CONTENT).forEach(el => { - const actualPadding = getStyle(el, 'paddingRight') + const actualPadding = getStyle(el, 'paddingRight') || '' setAttr(el, 'data-padding-right', actualPadding) setStyle(el, 'paddingRight', `${toFloat(getCS(el).paddingRight, 0) + scrollbarWidth}px`) body._paddingChangedForModal.push(el) @@ -167,7 +167,7 @@ const ModalManager = /*#__PURE__*/ Vue.extend({ // Adjust sticky content margin /* istanbul ignore next: difficult to test in JSDOM */ selectAll(Selector.STICKY_CONTENT).forEach(el => /* istanbul ignore next */ { - const actualMargin = getStyle(el, 'marginRight') + const actualMargin = getStyle(el, 'marginRight') || '' setAttr(el, 'data-margin-right', actualMargin) setStyle(el, 'marginRight', `${toFloat(getCS(el).marginRight, 0) - scrollbarWidth}px`) body._marginChangedForModal.push(el) @@ -175,7 +175,7 @@ const ModalManager = /*#__PURE__*/ Vue.extend({ // Adjust margin /* istanbul ignore next: difficult to test in JSDOM */ selectAll(Selector.NAVBAR_TOGGLER).forEach(el => /* istanbul ignore next */ { - const actualMargin = getStyle(el, 'marginRight') + const actualMargin = getStyle(el, 'marginRight') || '' setAttr(el, 'data-margin-right', actualMargin) setStyle(el, 'marginRight', `${toFloat(getCS(el).marginRight, 0) + scrollbarWidth}px`) body._marginChangedForModal.push(el)