Gildas 7 лет назад
Родитель
Сommit
3cfc1c84c4
1 измененных файлов с 7 добавлено и 7 удалено
  1. 7 7
      lib/single-file/htmlmini.js

+ 7 - 7
lib/single-file/htmlmini.js

@@ -143,9 +143,9 @@ this.htmlmini = this.htmlmini || (() => {
 
 	function collapseBooleanAttributes(node) {
 		if (node.nodeType == Node.ELEMENT_NODE) {
-			Array.from(node.attributes).forEach(attributeName => {
-				if (booleanAttributes.includes(attributeName)) {
-					node.setAttribute(attributeName, "");
+			Array.from(node.attributes).forEach(attribute => {
+				if (booleanAttributes.includes(attribute.name)) {
+					node.setAttribute(attribute.name, "");
 				}
 			});
 		}
@@ -193,11 +193,11 @@ this.htmlmini = this.htmlmini || (() => {
 
 	function removeEmptyAttributes(node) {
 		if (node.nodeType == Node.ELEMENT_NODE) {
-			Array.from(node.attributes).forEach(attributeName => {
-				if (safeToRemoveAttrs.includes(attributeName.toLowerCase())) {
-					const attributeValue = node.getAttribute(attributeName);
+			Array.from(node.attributes).forEach(attribute => {
+				if (safeToRemoveAttrs.includes(attribute.name.toLowerCase())) {
+					const attributeValue = node.getAttribute(attribute.name);
 					if (attributeValue === "" || (attributeValue || "").match(/^\s+$/)) {
-						node.removeAttribute(attributeName);
+						node.removeAttribute(attribute.name);
 					}
 				}
 			});