Permalink
Browse files

Fix a duplicated escaping problem on element()

The text argument of XMLFragment#element() is escaped twice.
The solution is provided by @kou.
  • Loading branch information...
1 parent 409ed70 commit 2cfe91ff67ea71c6750259fab9b7b589f275b78b @darashi darashi committed Jul 19, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −1 src/XMLFragment.coffee
  2. +6 −0 test/test.coffee
View
@@ -47,7 +47,7 @@ class XMLFragment
text = '' + text or ''
text = @escape text
@assertLegalChar text
- child.text text
+ child.raw text
@children.push child
return child
View
@@ -156,3 +156,9 @@ test7 = builder.begin('test7')
.doc().toString()
assert.strictEqual(xml7, test7)
+# test escape of "
+xml8 = '<test8><node>&quot;</node></test8>'
+test8 = builder.begin('test8')
+ .ele('node', '"')
+ .doc().toString()
+assert.strictEqual(xml8, test8)

0 comments on commit 2cfe91f

Please sign in to comment.