Socket
Socket
Sign inDemoInstall

w3c-xmlserializer

Package Overview
Dependencies
Maintainers
6
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

w3c-xmlserializer - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

23

lib/attributes.js

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

@@ -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, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
.replace(/&/ug, "&amp;")
.replace(/</ug, "&lt;")
.replace(/>/ug, "&gt;");
}

@@ -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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc