When the container padding is an empty string, handle it as 0px (#7349)

This commit is contained in:
Evert Timberg 2020-05-13 16:53:42 -04:00 committed by GitHub
parent a301ca148c
commit ae99039e4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}