[Pkg-javascript-commits] [ltx] 178/469: element: don't quote ' and " for vanilla text nodes
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 13:01:41 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository ltx.
commit cbc7c858ff2bec281897ebcf0043ed61f8674751
Author: Astro <astro at spaceboyz.net>
Date: Tue Aug 2 02:06:19 2011 +0200
element: don't quote ' and " for vanilla text nodes
---
lib/element.js | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/element.js b/lib/element.js
index 8d0441b..6b63af4 100644
--- a/lib/element.js
+++ b/lib/element.js
@@ -197,9 +197,9 @@ Element.prototype.write = function(writer) {
if (child.write)
child.write(writer);
else if (typeof child === 'string')
- writer(escapeXml(child));
+ writer(escapeXmlText(child));
else
- writer(escapeXml(child.toString()));
+ writer(escapeXmlText(child.toString()));
});
writer("</");
writer(this.name);
@@ -216,5 +216,12 @@ function escapeXml(s) {
replace(/'/g, ''');
};
+function escapeXmlText(s) {
+ return s.
+ replace(/\&/g, '&').
+ replace(/</g, '<').
+ replace(/>/g, '>');
+};
+
exports.Element = Element;
exports.escapeXml = escapeXml;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git
More information about the Pkg-javascript-commits
mailing list