Explorar o código

use forEach when removing items

Former-commit-id: e412049644dc6e2ec831a48cf53966196f0f5013
Gildas %!s(int64=6) %!d(string=hai) anos
pai
achega
61917dc657

+ 1 - 1
extension/ui/bg/ui-options.js

@@ -447,7 +447,7 @@
 	async function refresh(profileName) {
 		const [profiles, rules] = await Promise.all([browser.runtime.sendMessage({ method: "config.getProfiles" }), browser.runtime.sendMessage({ method: "config.getRules" })]);
 		const selectedProfileName = profileName || profileNamesInput.value || DEFAULT_PROFILE_NAME;
-		Array.from(profileNamesInput.childNodes, node => node.remove());
+		Array.from(profileNamesInput.childNodes).forEach(node => node.remove());
 		profileNamesInput.options.length = 0;
 		ruleProfileInput.options.length = 0;
 		ruleAutoSaveProfileInput.options.length = 0;

+ 1 - 1
lib/single-file/modules/html-minifier.js

@@ -218,7 +218,7 @@ this.singlefile.lib.modules.htmlMinifier = this.singlefile.lib.modules.htmlMinif
 
 	function removeEmptyAttributes(node) {
 		if (node.nodeType == Node_ELEMENT_NODE) {
-			Array.from(node.attributes, attribute => {
+			Array.from(node.attributes).forEach(attribute => {
 				if (safeToRemoveAttrs.includes(attribute.name.toLowerCase())) {
 					const attributeValue = node.getAttribute(attribute.name);
 					if (attributeValue == "" || (attributeValue || "").match(REGEXP_ENDS_WHITESPACE)) {

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

@@ -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, removeNode);
+								Array.from(node.childNodes).forEach(removeNode);
 							}
 						}
 					}
@@ -856,7 +856,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 						frameElement.removeAttribute("src");
 						frameElement.removeAttribute("srcdoc");
 					}
-					Array.from(frameElement.childNodes, node => node.remove());
+					Array.from(frameElement.childNodes).forEach(node => node.remove());
 					const frameWindowId = frameElement.getAttribute(util.WIN_ID_ATTRIBUTE_NAME);
 					if (frameWindowId) {
 						const frameData = this.options.frames.find(frame => frame.windowId == frameWindowId);