|
|
@@ -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);
|
|
|
}
|
|
|
}
|
|
|
});
|