Skip to content
Browse files

Pass arguments to att()

  • Loading branch information...
1 parent c1a5fc5 commit e9f5daa6a1f87cd963a92809d32ba2c97a5bd340 @oozcitak committed Dec 29, 2013
Showing with 5 additions and 6 deletions.
  1. +5 −6 src/XMLElement.coffee
View
11 src/XMLElement.coffee
@@ -22,10 +22,9 @@ module.exports = class XMLElement extends XMLNode
@name = @stringify.eleName name
@children = []
@instructions = []
-
@attributes = {}
- for own attName, attValue of attributes
- @attribute attName, attValue
+
+ @attribute attributes if attributes?
# Clones self
@@ -76,13 +75,13 @@ module.exports = class XMLElement extends XMLNode
#
# `name` attribute name
removeAttribute: (name) ->
+ if not name?
+ throw new Error "Missing attribute name"
+
if _.isArray name # expand if array
for attName in name
delete @attributes[attName]
else
- if not name?
- throw new Error "Missing attribute name"
-
delete @attributes[name]
return @

0 comments on commit e9f5daa

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