浏览代码

ensure body is defined

Gildas 7 年之前
父节点
当前提交
1b5d1155d8
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lib/single-file/doc-helper.js

+ 1 - 1
lib/single-file/doc-helper.js

@@ -62,7 +62,7 @@ this.docHelper = this.docHelper || (() => {
 		if (win) {
 		if (win) {
 			canvasData = getCanvasData(doc, win);
 			canvasData = getCanvasData(doc, win);
 			imageData = getImageData(doc, win, options);
 			imageData = getImageData(doc, win, options);
-			if (options.removeHiddenElements || options.removeUnusedStyles || options.compressHTML) {
+			if (doc.body && (options.removeHiddenElements || options.removeUnusedStyles || options.compressHTML)) {
 				let elementsInfo = getElementsInfo(win, doc.body);
 				let elementsInfo = getElementsInfo(win, doc.body);
 				if (options.removeHiddenElements) {
 				if (options.removeHiddenElements) {
 					const markerRemovedContent = removedContentAttributeName(options.sessionId);
 					const markerRemovedContent = removedContentAttributeName(options.sessionId);