|
|
@@ -153,15 +153,16 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
|
|
|
class Runner {
|
|
|
constructor(options, root) {
|
|
|
+ const rootDocDefined = root && this.options.doc;
|
|
|
this.root = root;
|
|
|
this.options = options;
|
|
|
- this.options.url = this.options.url || (this.options.doc && this.options.doc.location.href);
|
|
|
- this.options.baseURI = this.options.doc && this.options.doc.baseURI;
|
|
|
+ this.options.url = this.options.url || (rootDocDefined && this.options.doc.location.href);
|
|
|
+ this.options.baseURI = rootDocDefined && this.options.doc.baseURI;
|
|
|
this.options.rootDocument = root;
|
|
|
this.options.updatedResources = this.options.updatedResources || {};
|
|
|
this.batchRequest = new BatchRequest();
|
|
|
this.processor = new Processor(options, this.batchRequest);
|
|
|
- if (root && this.options.doc) {
|
|
|
+ if (rootDocDefined) {
|
|
|
const docData = util.preProcessDoc(this.options.doc, this.options.win, this.options);
|
|
|
this.options.canvases = docData.canvases;
|
|
|
this.options.fonts = docData.fonts;
|
|
|
@@ -177,7 +178,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
if (this.options.saveRawPage) {
|
|
|
this.options.removeFrames = true;
|
|
|
}
|
|
|
- this.options.content = this.options.content || (root && this.options.doc ? util.serialize(this.options.doc) : null);
|
|
|
+ this.options.content = this.options.content || (rootDocDefined ? util.serialize(this.options.doc) : null);
|
|
|
this.onprogress = options.onprogress || (() => { });
|
|
|
}
|
|
|
|