summaryrefslogtreecommitdiffstats
path: root/js/row.js
diff options
context:
space:
mode:
authorOndrej Zara <ondrej.zara@firma.seznam.cz>2015-08-04 16:36:30 +0200
committerOndrej Zara <ondrej.zara@firma.seznam.cz>2015-08-04 16:36:30 +0200
commit921ccb4b2139f6239da2ad76f07217775c281ea8 (patch)
treee1e42f5ef32d31429578dbbc343a7a59073f2256 /js/row.js
parenta8f650f5c14a5d3a194ce470a49c6c483c91e9a9 (diff)
downloadwwwsqldesigner-921ccb4b2139f6239da2ad76f07217775c281ea8.zip
wwwsqldesigner-921ccb4b2139f6239da2ad76f07217775c281ea8.tar.gz
wwwsqldesigner-921ccb4b2139f6239da2ad76f07217775c281ea8.tar.bz2
xml escaping, fixes #207
Diffstat (limited to 'js/row.js')
-rw-r--r--js/row.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/js/row.js b/js/row.js
index ac1c94b..a9abf86 100644
--- a/js/row.js
+++ b/js/row.js
@@ -143,7 +143,8 @@ SQL.Row.prototype.buildEdit = function() {
elms.push(["null",this.dom.nll]);
this.dom.comment = OZ.DOM.elm("span",{className:"comment"});
- this.dom.comment.innerHTML = this.data.comment;
+ this.dom.comment.innerHTML = "";
+ this.dom.comment.appendChild(document.createTextNode(this.data.comment));
this.dom.commentbtn = OZ.DOM.elm("input");
this.dom.commentbtn.type = "button";
@@ -180,7 +181,8 @@ SQL.Row.prototype.changeComment = function(e) {
var c = prompt(_("commenttext"),this.data.comment);
if (c === null) { return; }
this.data.comment = c;
- this.dom.comment.innerHTML = this.data.comment;
+ this.dom.comment.innerHTML = "";
+ this.dom.comment.appendChild(document.createTextNode(this.data.comment));
}
SQL.Row.prototype.expand = function() {
@@ -336,7 +338,7 @@ SQL.Row.prototype.toXML = function() {
} else if (d != "CURRENT_TIMESTAMP") {
d = q+d+q;
}
- xml += "<default>"+d+"</default>";
+ xml += "<default>"+SQL.escape(d)+"</default>";
}
for (var i=0;i<this.relations.length;i++) {
@@ -346,8 +348,7 @@ SQL.Row.prototype.toXML = function() {
}
if (this.data.comment) {
- var escaped = this.data.comment.replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;");
- xml += "<comment>"+escaped+"</comment>\n";
+ xml += "<comment>"+SQL.escape(this.data.comment)+"</comment>\n";
}
xml += "</row>\n";