Merge pull request #308 from strk/aposquote

Fix escaping of single quote.
This commit is contained in:
Dane Springmeyer 2014-04-10 21:22:50 -04:00
commit b9309a7f80
3 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ tree.Quoted.prototype = {
toString: function(quotes) {
var xmlvalue = this.value
.replace(/&/g, '&')
.replace(/\'/g, ''')
.replace(/\'/g, '\\\'')
.replace(/\"/g, '"')
.replace(/</g, '&lt;')
.replace(/\>/g, '&gt;');

View File

@ -17,7 +17,7 @@ describe('Quoted', function() {
it('should produce xml-friendly output', function() {
var f = new tree.Quoted("Tom's & \"<quoted>\"");
assert.ok(f);
assert.equal(f.toString(true), "'Tom&apos;s &amp; &quot;&lt;quoted&gt;&quot;'");
assert.equal(f.toString(true), "'Tom\\'s &amp; &quot;&lt;quoted&gt;&quot;'");
});
});
});

View File

@ -5,7 +5,7 @@
<Style name="world" filter-mode="first">
<Rule>
<Filter>([name2] = ' Sa&apos;ad')</Filter>
<Filter>([name2] = ' Sa\'ad')</Filter>
<PolygonSymbolizer fill="#ffffff" />
</Rule>
</Style>