[Dojo-checkins] peller - r17859 - in dojox/trunk/atom: io tests/io
dojo-checkins-admin at dojotoolkit.org
dojo-checkins-admin at dojotoolkit.org
Wed Jun 10 20:28:47 EDT 2009
Author: peller
Date: Wed Jun 10 17:28:44 2009
New Revision: 17859
Modified:
dojox/trunk/atom/io/model.js
dojox/trunk/atom/tests/io/module.js
Log:
unEscape needs to replace & after doing other replacements. Included unit test. Fixes #9391 !strict
Modified: dojox/trunk/atom/io/model.js
==============================================================================
--- dojox/trunk/atom/io/model.js (original)
+++ dojox/trunk/atom/io/model.js Wed Jun 10 17:28:44 2009
@@ -143,9 +143,8 @@
// The string to escape
// returns:
// HTML String with special characters (<,>,&, ", etc,) escaped.
- str = str.replace(/&/gm, "&").replace(/</gm, "<").replace(/>/gm, ">").replace(/"/gm, """);
- str = str.replace(/'/gm, "'");
- return str;
+ return str.replace(/&/gm, "&").replace(/</gm, "<").replace(/>/gm, ">").replace(/"/gm, """)
+ .replace(/'/gm, "'"); // String
},
unEscapeHtml: function(/*String*/str){
// summary:
@@ -157,9 +156,8 @@
// The string to un-escape.
// returns:
// HTML String converted back to the normal text (unescaped) characters (<,>,&, ", etc,).
- str = str.replace(/&/gm, "&").replace(/</gm, "<").replace(/>/gm, ">").replace(/"/gm, "\"");
- str = str.replace(/'/gm, "'");
- return str;
+ return str.replace(/</gm, "<").replace(/>/gm, ">").replace(/"/gm, "\"")
+ .replace(/'/gm, "'").replace(/&/gm, "&"); // String
},
getNodename: function(/*DOM node*/node){
// summary:
Modified: dojox/trunk/atom/tests/io/module.js
==============================================================================
--- dojox/trunk/atom/tests/io/module.js (original)
+++ dojox/trunk/atom/tests/io/module.js Wed Jun 10 17:28:44 2009
@@ -35,6 +35,7 @@
var unescaped = dojox.atom.io.model.util.unEscapeHtml(original);
var expected = "<html><head><title>This is a \"Test Title\"</title></head><body class=\"tundra\">Woo hoo, this is an awesome & exciting test case!</body></html>";
t.is(unescaped, expected);
+ t.is("<", dojox.atom.io.model.util.unEscapeHtml("&lt;"));
},
// dojox.atom.io.model.util.getNodename
More information about the Dojo-checkins
mailing list