w3c-xmlserializer
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -8,3 +8,3 @@ "use strict"; | ||
function generatePrefix(map, newNamespace, prefixIndex) { | ||
const generatedPrefix = "ns" + prefixIndex; | ||
const generatedPrefix = `ns${prefixIndex}`; | ||
map[newNamespace] = [generatedPrefix]; | ||
@@ -31,9 +31,9 @@ return generatedPrefix; | ||
return value | ||
.replace(/&/g, "&") | ||
.replace(/"/g, """) | ||
.replace(/</g, "<") | ||
.replace(/>/g, ">") | ||
.replace(/\t/g, "	") | ||
.replace(/\n/g, "
") | ||
.replace(/\r/g, "
"); | ||
.replace(/&/ug, "&") | ||
.replace(/"/ug, """) | ||
.replace(/</ug, "<") | ||
.replace(/>/ug, ">") | ||
.replace(/\t/ug, "	") | ||
.replace(/\n/ug, "
") | ||
.replace(/\r/ug, "
"); | ||
} | ||
@@ -109,3 +109,3 @@ | ||
if (candidatePrefix !== null) { | ||
result += candidatePrefix + ":"; | ||
result += `${candidatePrefix}:`; | ||
} | ||
@@ -120,6 +120,3 @@ if ( | ||
} | ||
result += `${attr.localName}="${serializeAttributeValue( | ||
attr.value, | ||
requireWellFormed | ||
)}"`; | ||
result += `${attr.localName}="${serializeAttributeValue(attr.value, requireWellFormed)}"`; | ||
} | ||
@@ -126,0 +123,0 @@ return result; |
@@ -8,4 +8,4 @@ "use strict"; | ||
const XML_CHAR = /^(\x09|\x0A|\x0D|[\x20-\uD7FF]|[\uE000-\uFFFD]|(?:[\uD800-\uDBFF][\uDC00-\uDFFF]))*$/; | ||
const PUBID_CHAR = /^(\x20|\x0D|\x0A|[a-zA-Z0-9]|[-'()+,./:=?;!*#@$_%])*$/; | ||
const XML_CHAR = /^(\x09|\x0A|\x0D|[\x20-\uD7FF]|[\uE000-\uFFFD]|(?:[\uD800-\uDBFF][\uDC00-\uDFFF]))*$/u; | ||
const PUBID_CHAR = /^(\x20|\x0D|\x0A|[a-zA-Z0-9]|[-'()+,./:=?;!*#@$_%])*$/u; | ||
@@ -84,3 +84,3 @@ function asciiCaseInsensitiveMatch(a, b) { | ||
} | ||
return markup + ">"; | ||
return `${markup}>`; | ||
} | ||
@@ -158,5 +158,5 @@ | ||
return node.data | ||
.replace(/&/g, "&") | ||
.replace(/</g, "<") | ||
.replace(/>/g, ">"); | ||
.replace(/&/ug, "&") | ||
.replace(/</ug, "<") | ||
.replace(/>/ug, ">"); | ||
} | ||
@@ -189,3 +189,3 @@ | ||
let ignoreNamespaceDefinitionAttr = false; | ||
const map = Object.assign({}, prefixMap); | ||
const map = { ...prefixMap }; | ||
const localPrefixesMap = Object.create(null); | ||
@@ -204,3 +204,3 @@ const localDefaultNamespace = recordNamespaceInformation( | ||
if (ns === NAMESPACES.XML) { | ||
qualifiedName = "xml:" + node.localName; | ||
qualifiedName = `xml:${node.localName}`; | ||
} else { | ||
@@ -220,3 +220,3 @@ qualifiedName = node.localName; | ||
if (candidatePrefix !== null) { | ||
qualifiedName = candidatePrefix + ":" + node.localName; | ||
qualifiedName = `${candidatePrefix}:${node.localName}`; | ||
if ( | ||
@@ -239,7 +239,4 @@ localDefaultNamespace !== null && | ||
} | ||
qualifiedName = prefix + ":" + node.localName; | ||
markup += `${qualifiedName} xmlns:${prefix}="${attributeUtils.serializeAttributeValue( | ||
ns, | ||
requireWellFormed | ||
)}"`; | ||
qualifiedName = `${prefix}:${node.localName}`; | ||
markup += `${qualifiedName} xmlns:${prefix}="${attributeUtils.serializeAttributeValue(ns, requireWellFormed)}"`; | ||
if (localDefaultNamespace !== null) { | ||
@@ -253,6 +250,3 @@ inheritedNs = | ||
inheritedNs = ns; | ||
markup += `${qualifiedName} xmlns="${attributeUtils.serializeAttributeValue( | ||
ns, | ||
requireWellFormed | ||
)}"`; | ||
markup += `${qualifiedName} xmlns="${attributeUtils.serializeAttributeValue(ns, requireWellFormed)}"`; | ||
} else { | ||
@@ -314,3 +308,3 @@ qualifiedName = node.localName; | ||
function serializeCDATASection(node) { | ||
return "<![CDATA[" + node.data + "]]>"; | ||
return `<![CDATA[${node.data}]]>`; | ||
} | ||
@@ -317,0 +311,0 @@ |
The MIT License (MIT) | ||
===================== | ||
Copyright © 2016 Sebastian Mayr | ||
Copyright © Sebastian Mayr | ||
@@ -6,0 +6,0 @@ Permission is hereby granted, free of charge, to any person |
@@ -10,11 +10,12 @@ { | ||
], | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"license": "MIT", | ||
"dependencies": { | ||
"xml-name-validator": "^3.0.0" | ||
"xml-name-validator": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^6.8.0", | ||
"jest": "^24.9.0", | ||
"jsdom": "^15.2.1" | ||
"@domenic/eslint-config": "^1.4.0", | ||
"eslint": "^7.32.0", | ||
"jest": "^27.2.0", | ||
"jsdom": "^17.0.0" | ||
}, | ||
@@ -31,4 +32,4 @@ "repository": "jsdom/w3c-xmlserializer", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=12" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
18001
4
498
+ Addedxml-name-validator@4.0.0(transitive)
- Removedxml-name-validator@3.0.0(transitive)
Updatedxml-name-validator@^4.0.0