]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Check to ensure dom node exists when calculating size. Fixes #919
authoretimberg <evert.timberg@gmail.com>
Mon, 8 Feb 2016 00:23:54 +0000 (19:23 -0500)
committeretimberg <evert.timberg@gmail.com>
Mon, 8 Feb 2016 00:23:54 +0000 (19:23 -0500)
src/Chart.Core.js

index 3a21f0abd0c7f6455a2525e5f1220307781cfd02..143244a3d9d636a0812db5e44f77b9949c112a8a 100755 (executable)
                        var container = domNode.parentNode,
                            padding = parseInt(getStyle(container, 'padding-left')) + parseInt(getStyle(container, 'padding-right'));
                        // TODO = check cross browser stuff with this.
-                       return container.clientWidth - padding;
+                       return container ? container.clientWidth - padding : 0;
                },
                getMaximumHeight = helpers.getMaximumHeight = function(domNode){
                        var container = domNode.parentNode,
                            padding = parseInt(getStyle(container, 'padding-bottom')) + parseInt(getStyle(container, 'padding-top'));
                        // TODO = check cross browser stuff with this.
-                       return container.clientHeight - padding;
+                       return container ? container.clientHeight - padding : 0;
                },
                getStyle = helpers.getStyle = function (el, property) {
                        return el.currentStyle ?