Skip to content

Commit e9f5daa

Browse files
committed
Pass arguments to att()
1 parent c1a5fc5 commit e9f5daa

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/XMLElement.coffee

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ module.exports = class XMLElement extends XMLNode
2222
@name = @stringify.eleName name
2323
@children = []
2424
@instructions = []
25-
2625
@attributes = {}
27-
for own attName, attValue of attributes
28-
@attribute attName, attValue
26+
27+
@attribute attributes if attributes?
2928

3029

3130
# Clones self
@@ -76,13 +75,13 @@ module.exports = class XMLElement extends XMLNode
7675
#
7776
# `name` attribute name
7877
removeAttribute: (name) ->
78+
if not name?
79+
throw new Error "Missing attribute name"
80+
7981
if _.isArray name # expand if array
8082
for attName in name
8183
delete @attributes[attName]
8284
else
83-
if not name?
84-
throw new Error "Missing attribute name"
85-
8685
delete @attributes[name]
8786

8887
return @

0 commit comments

Comments
 (0)