We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2986b0a commit b398ec5Copy full SHA for b398ec5
src/XMLNode.coffee
@@ -61,8 +61,6 @@ module.exports = class XMLNode
61
lastChild = @element key, val
62
63
else
64
- name = '' + name
65
-
66
# text node
67
if @stringify.convertTextKey and name.indexOf(@stringify.convertTextKey) == 0
68
lastChild = @text text
@@ -147,6 +145,11 @@ module.exports = class XMLNode
147
145
# `attributes` an object containing name/value pairs of attributes
148
146
# `text` element text
149
node: (name, attributes, text) ->
+ attributes ?= {}
+ # swap argument order: text <-> attributes
150
+ if not _.isObject attributes
151
+ [text, attributes] = [attributes, text]
152
+
153
XMLElement = require './XMLElement'
154
child = new XMLElement @, name, attributes
155
child.text(text) if text?
0 commit comments