Просмотр исходного кода

fixed regression introduced by #b57cf9b

Former-commit-id: 6b5ef5c215d743229c8d04cfc0e7413271a48b65
Gildas 6 лет назад
Родитель
Сommit
474895f075
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      lib/single-file/single-file-core.js

+ 3 - 3
lib/single-file/single-file-core.js

@@ -161,7 +161,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 			this.options.updatedResources = this.options.updatedResources || {};
 			this.options.updatedResources = this.options.updatedResources || {};
 			this.batchRequest = new BatchRequest();
 			this.batchRequest = new BatchRequest();
 			this.processor = new Processor(options, this.batchRequest);
 			this.processor = new Processor(options, this.batchRequest);
-			if (this.options.doc) {
+			if (root && this.options.doc) {
 				const docData = util.preProcessDoc(this.options.doc, this.options.win, this.options);
 				const docData = util.preProcessDoc(this.options.doc, this.options.win, this.options);
 				this.options.canvases = docData.canvases;
 				this.options.canvases = docData.canvases;
 				this.options.fonts = docData.fonts;
 				this.options.fonts = docData.fonts;
@@ -177,7 +177,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 			if (this.options.saveRawPage) {
 			if (this.options.saveRawPage) {
 				this.options.removeFrames = true;
 				this.options.removeFrames = true;
 			}
 			}
-			this.options.content = this.options.content || (this.options.doc ? util.serialize(this.options.doc) : null);
+			this.options.content = this.options.content || (root && this.options.doc ? util.serialize(this.options.doc) : null);
 			this.onprogress = options.onprogress || (() => { });
 			this.onprogress = options.onprogress || (() => { });
 		}
 		}
 
 
@@ -191,7 +191,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 			this.onprogress(new ProgressEvent(RESOURCES_INITIALIZING, { pageURL: this.options.url }));
 			this.onprogress(new ProgressEvent(RESOURCES_INITIALIZING, { pageURL: this.options.url }));
 			await this.executeStage(RESOLVE_URLS_STAGE);
 			await this.executeStage(RESOLVE_URLS_STAGE);
 			this.pendingPromises = this.executeStage(REPLACE_DATA_STAGE);
 			this.pendingPromises = this.executeStage(REPLACE_DATA_STAGE);
-			if (this.options.doc) {
+			if (this.root && this.options.doc) {
 				util.postProcessDoc(this.options.doc, this.markedElements);
 				util.postProcessDoc(this.options.doc, this.markedElements);
 			}
 			}
 			this.options.doc = null;
 			this.options.doc = null;