Skip to content
Browse files

Do not coerce element name

  • Loading branch information...
1 parent 2986b0a commit b398ec538a6ffd6a78f3b49b0a63566ce415acef @oozcitak committed Dec 28, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/XMLNode.coffee
View
7 src/XMLNode.coffee
@@ -61,8 +61,6 @@ module.exports = class XMLNode
lastChild = @element key, val
else
- name = '' + name
-
# text node
if @stringify.convertTextKey and name.indexOf(@stringify.convertTextKey) == 0
lastChild = @text text
@@ -147,6 +145,11 @@ module.exports = class XMLNode
# `attributes` an object containing name/value pairs of attributes
# `text` element text
node: (name, attributes, text) ->
+ attributes ?= {}
+ # swap argument order: text <-> attributes
+ if not _.isObject attributes
+ [text, attributes] = [attributes, text]
+
XMLElement = require './XMLElement'
child = new XMLElement @, name, attributes
child.text(text) if text?

0 comments on commit b398ec5

Please sign in to comment.
Something went wrong with that request. Please try again.