|
|
@@ -525,7 +525,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
|
|
|
function removeUnmarkedElements(element) {
|
|
|
let selectedElementFound = false;
|
|
|
- Array.from(element.childNodes).forEach(node => {
|
|
|
+ Array.from(element.childNodes, node => {
|
|
|
if (node.nodeType == 1) {
|
|
|
const isSelectedElement = node.getAttribute(SELECTED_CONTENT_ATTRIBUTE_NAME) == "";
|
|
|
selectedElementFound = selectedElementFound || isSelectedElement;
|
|
|
@@ -537,7 +537,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
} else {
|
|
|
if (canHideNode(node)) {
|
|
|
node.style.setProperty("display", "none", "important");
|
|
|
- Array.from(node.childNodes).forEach(removeNode);
|
|
|
+ Array.from(node.childNodes, removeNode);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1009,13 +1009,13 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
}
|
|
|
|
|
|
async processStylesheets() {
|
|
|
- await Promise.all(Array.from(this.stylesheets).map(([, stylesheetInfo]) =>
|
|
|
+ await Promise.all(Array.from(this.stylesheets, ([, stylesheetInfo]) =>
|
|
|
ProcessorHelper.processStylesheet(stylesheetInfo.stylesheet.children, this.baseURI, this.options, this.cssVariables, this.batchRequest)
|
|
|
));
|
|
|
}
|
|
|
|
|
|
async processStyleAttributes() {
|
|
|
- return Promise.all(Array.from(this.styles).map(([, declarationList]) =>
|
|
|
+ return Promise.all(Array.from(this.styles, ([, declarationList]) =>
|
|
|
ProcessorHelper.processStyle(declarationList.children.toArray(), this.baseURI, this.options, this.cssVariables, this.batchRequest)
|
|
|
));
|
|
|
}
|
|
|
@@ -1048,7 +1048,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
}
|
|
|
|
|
|
async processScripts() {
|
|
|
- await Promise.all(Array.from(this.doc.querySelectorAll("script[src]")).map(async scriptElement => {
|
|
|
+ await Promise.all(Array.from(this.doc.querySelectorAll("script[src]"), async scriptElement => {
|
|
|
let resourceURL;
|
|
|
const scriptSrc = scriptElement.getAttribute("src");
|
|
|
scriptElement.removeAttribute("src");
|
|
|
@@ -1556,7 +1556,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
}
|
|
|
|
|
|
static async processAttribute(resourceElements, attributeName, baseURI, options, cssVariables, styles, batchRequest, processDuplicates, removeElementIfMissing) {
|
|
|
- await Promise.all(Array.from(resourceElements).map(async resourceElement => {
|
|
|
+ await Promise.all(Array.from(resourceElements, async resourceElement => {
|
|
|
let resourceURL = resourceElement.getAttribute(attributeName);
|
|
|
resourceURL = Util.normalizeURL(resourceURL);
|
|
|
if (!Util.testIgnoredPath(resourceURL)) {
|
|
|
@@ -1596,7 +1596,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
|
|
|
static async processXLinks(resourceElements, baseURI, options, batchRequest) {
|
|
|
const attributeName = "xlink:href";
|
|
|
- await Promise.all(Array.from(resourceElements).map(async resourceElement => {
|
|
|
+ await Promise.all(Array.from(resourceElements, async resourceElement => {
|
|
|
const originalResourceURL = resourceElement.getAttribute(attributeName);
|
|
|
let resourceURL = Util.normalizeURL(originalResourceURL);
|
|
|
if (Util.testValidPath(resourceURL) && !Util.testIgnoredPath(resourceURL)) {
|
|
|
@@ -1631,7 +1631,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
}
|
|
|
|
|
|
static async processSrcset(resourceElements, attributeName, baseURI, batchRequest) {
|
|
|
- await Promise.all(Array.from(resourceElements).map(async resourceElement => {
|
|
|
+ await Promise.all(Array.from(resourceElements, async resourceElement => {
|
|
|
const srcset = util.parseSrcset(resourceElement.getAttribute(attributeName));
|
|
|
const srcsetValues = await Promise.all(srcset.map(async srcsetValue => {
|
|
|
let resourceURL = Util.normalizeURL(srcsetValue.url);
|