1
0
mirror of https://github.com/S2-/minifyfromhtml.git synced 2025-08-03 20:30:04 +02:00

update packages to latest version

This commit is contained in:
s2
2022-08-20 18:51:33 +02:00
parent 09663a35a5
commit 806ebf9a57
4513 changed files with 366205 additions and 92512 deletions

View File

@@ -5,7 +5,7 @@ const xnv = require("xml-name-validator");
const { NAMESPACES } = require("./constants");
function generatePrefix(map, newNamespace, prefixIndex) {
const generatedPrefix = "ns" + prefixIndex;
const generatedPrefix = `ns${prefixIndex}`;
map[newNamespace] = [generatedPrefix];
return generatedPrefix;
}
@@ -27,13 +27,13 @@ function serializeAttributeValue(value/* , requireWellFormed*/) {
}
// TODO: Check well-formedness
return value
.replace(/&/g, "&")
.replace(/"/g, """)
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/\t/g, "&#x9;")
.replace(/\n/g, "&#xA;")
.replace(/\r/g, "&#xD;");
.replace(/&/ug, "&amp;")
.replace(/"/ug, "&quot;")
.replace(/</ug, "&lt;")
.replace(/>/ug, "&gt;")
.replace(/\t/ug, "&#x9;")
.replace(/\n/ug, "&#xA;")
.replace(/\r/ug, "&#xD;");
}
function serializeAttributes(
@@ -104,7 +104,7 @@ function serializeAttributes(
result += " ";
if (candidatePrefix !== null) {
result += candidatePrefix + ":";
result += `${candidatePrefix}:`;
}
if (
requireWellFormed &&
@@ -114,10 +114,7 @@ function serializeAttributes(
) {
throw new Error("Invalid attribute localName value");
}
result += `${attr.localName}="${serializeAttributeValue(
attr.value,
requireWellFormed
)}"`;
result += `${attr.localName}="${serializeAttributeValue(attr.value, requireWellFormed)}"`;
}
return result;
}