Improve node.js support
This change fixes "Unhandled rejection ReferenceError: HTMLElement is not defined" issue that is discussed in more detail in #8489.
This commit is contained in:
parent
3bfc797bc7
commit
c20426efef
@ -2112,8 +2112,9 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
var heightScale = Math.max(Math.sqrt(c * c + d * d), 1);
|
var heightScale = Math.max(Math.sqrt(c * c + d * d), 1);
|
||||||
|
|
||||||
var imgToPaint, tmpCanvas;
|
var imgToPaint, tmpCanvas;
|
||||||
// instanceof HTMLElement does not work in jsdom node.js module
|
// typeof check is needed due to node.js support, see issue #8489
|
||||||
if (imgData instanceof HTMLElement || !imgData.data) {
|
if ((typeof HTMLElement === 'function' &&
|
||||||
|
imgData instanceof HTMLElement) || !imgData.data) {
|
||||||
imgToPaint = imgData;
|
imgToPaint = imgData;
|
||||||
} else {
|
} else {
|
||||||
tmpCanvas = this.cachedCanvases.getCanvas('inlineImage',
|
tmpCanvas = this.cachedCanvases.getCanvas('inlineImage',
|
||||||
|
Loading…
Reference in New Issue
Block a user