]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
When the container padding is an empty string, handle it as 0px (#7349)
authorEvert Timberg <evert.timberg+github@gmail.com>
Wed, 13 May 2020 20:53:42 +0000 (16:53 -0400)
committerGitHub <noreply@github.com>
Wed, 13 May 2020 20:53:42 +0000 (16:53 -0400)
src/helpers/helpers.dom.js

index 6a6429316e885ed1b40a46b9b2a4e87b3e48a001..74d8f957641a8158e39063335534cde356c52042 100644 (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);
 }