|
@@ -347,7 +347,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
content = await DocUtil.getContent(this.baseURI, { asDataURI: false, maxResourceSize: this.options.maxResourceSize, maxResourceSizeEnabled: this.options.maxResourceSizeEnabled, charset });
|
|
content = await DocUtil.getContent(this.baseURI, { asDataURI: false, maxResourceSize: this.options.maxResourceSize, maxResourceSizeEnabled: this.options.maxResourceSizeEnabled, charset });
|
|
|
pageContent = content.data;
|
|
pageContent = content.data;
|
|
|
}
|
|
}
|
|
|
- this.doc = DocUtil.createDoc(pageContent, this.baseURI);
|
|
|
|
|
|
|
+ this.doc = DocUtil.parseDocContent(pageContent, this.baseURI);
|
|
|
if (this.options.saveRawPage) {
|
|
if (this.options.saveRawPage) {
|
|
|
let charset;
|
|
let charset;
|
|
|
this.doc.querySelectorAll("meta[charset], meta[http-equiv=\"content-type\"]").forEach(element => {
|
|
this.doc.querySelectorAll("meta[charset], meta[http-equiv=\"content-type\"]").forEach(element => {
|
|
@@ -1429,18 +1429,13 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
if (Util.testValidURL(resourceURL, baseURI, options.url)) {
|
|
if (Util.testValidURL(resourceURL, baseURI, options.url)) {
|
|
|
try {
|
|
try {
|
|
|
const { content } = await batchRequest.addURL(resourceURL);
|
|
const { content } = await batchRequest.addURL(resourceURL);
|
|
|
- const DOMParser = DocUtil.getParser();
|
|
|
|
|
- if (DOMParser) {
|
|
|
|
|
- const svgDoc = new DOMParser().parseFromString(content, "image/svg+xml");
|
|
|
|
|
- const hashMatch = originalResourceURL.match(REGEXP_URL_HASH);
|
|
|
|
|
- if (hashMatch && hashMatch[0]) {
|
|
|
|
|
- const symbolElement = svgDoc.querySelector(hashMatch[0]);
|
|
|
|
|
- if (symbolElement) {
|
|
|
|
|
- resourceElement.setAttribute(attributeName, hashMatch[0]);
|
|
|
|
|
- resourceElement.parentElement.insertBefore(symbolElement, resourceElement.parentElement.firstChild);
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- resourceElement.setAttribute(attributeName, PREFIX_DATA_URI_IMAGE_SVG + "," + content);
|
|
|
|
|
|
|
+ const hashMatch = originalResourceURL.match(REGEXP_URL_HASH);
|
|
|
|
|
+ if (hashMatch && hashMatch[0]) {
|
|
|
|
|
+ const svgDoc = DocUtil.parseSVGContent(content);
|
|
|
|
|
+ const symbolElement = svgDoc.querySelector(hashMatch[0]);
|
|
|
|
|
+ if (symbolElement) {
|
|
|
|
|
+ resourceElement.setAttribute(attributeName, hashMatch[0]);
|
|
|
|
|
+ resourceElement.parentElement.insertBefore(symbolElement, resourceElement.parentElement.firstChild);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
resourceElement.setAttribute(attributeName, PREFIX_DATA_URI_IMAGE_SVG + "," + content);
|
|
resourceElement.setAttribute(attributeName, PREFIX_DATA_URI_IMAGE_SVG + "," + content);
|