mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
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
1 changed files with 3 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue