Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix a problem with text node creation from ''

  • Loading branch information...
commit 8c687d1dc6a05ec73c160fcdf1d939bed624dd73 1 parent 409ed70
@darashi darashi authored
Showing with 7 additions and 2 deletions.
  1. +2 −2 src/XMLFragment.coffee
  2. +5 −0 test/test.coffee
View
4 src/XMLFragment.coffee
@@ -305,7 +305,7 @@ class XMLFragment
# open tag
if pretty
r += space
- if not @value
+ if not @value?
r += '<' + @name
else
r += '' + @value
@@ -319,7 +319,7 @@ class XMLFragment
if @children.length == 0
# empty element
- if not @value
+ if not @value?
r += if @name == '?xml' then '?>' else if @name == '!DOCTYPE' then '>' else '/>'
if pretty
r += newline
View
5 test/test.coffee
@@ -156,3 +156,8 @@ test7 = builder.begin('test7')
.doc().toString()
assert.strictEqual(xml7, test7)
+# Test text node with empty string
+xml9 = '<test9></test9>'
+test9 = builder.begin('test9').text('')
+ .doc().toString()
+assert.strictEqual(xml9, test9)
Please sign in to comment.
Something went wrong with that request. Please try again.