Use document when getRootNode is unsupported (#6630)

This commit is contained in:
Jukka Kurkela
2019-10-29 23:22:35 +02:00
committed by Evert Timberg
parent 994fe712de
commit 09bd524dd3

View File

@@ -339,7 +339,7 @@ module.exports = {
// If the canvas is in a shadow DOM, then the styles must also be inserted
// into the same shadow DOM.
// https://github.com/chartjs/Chart.js/issues/5763
var root = canvas.getRootNode();
var root = canvas.getRootNode ? canvas.getRootNode() : document;
var targetNode = root.host ? root : document.head;
injectCSS(targetNode, stylesheet);
}