From ae99039e4d686de0999631828f6385378dc3b2a3 Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Wed, 13 May 2020 16:53:42 -0400 Subject: [PATCH] When the container padding is an empty string, handle it as 0px (#7349) --- src/helpers/helpers.dom.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/helpers/helpers.dom.js b/src/helpers/helpers.dom.js index 6a6429316..74d8f9576 100644 --- a/src/helpers/helpers.dom.js +++ b/src/helpers/helpers.dom.js @@ -80,6 +80,12 @@ function getConstraintHeight(domNode) { function _calculatePadding(container, padding, parentDimension) { padding = getStyle(container, padding); + // If the padding is not set at all and the node is not in the DOM, this can be an empty string + // In that case, we need to handle it as no padding + if (padding === '') { + return 0; + } + return padding.indexOf('%') > -1 ? parentDimension * parseInt(padding, 10) / 100 : parseInt(padding, 10); }