Permalink
Browse files

undefined value for attr should not result in touching that attr

  • Loading branch information...
1 parent 777d360 commit 4216330ac2e478cb4d13042cdae18548bef4fb21 @dodo committed Jun 3, 2012
Showing with 3 additions and 1 deletion.
  1. +1 −0 src/test/xml.coffee
  2. +2 −1 src/xml.coffee
View
@@ -79,6 +79,7 @@ module.exports =
item.attr(a:1, b:2, c:3)
.attr('value', "b")
æ.equal item.attr('value'), "b"
+ æ.equal item.attr('non-existant'), undefined
item.up().up().end()
View
@@ -127,7 +127,8 @@ class Tag extends EventEmitter
attr: (key, value) =>
if typeof key is 'string'
- if not value? and ((attr = @builder?.query 'attr', this, key))?
+ if not value?
+ attr = @builder?.query('attr', this, key)
# attr is not defined if attr is undefined
# attr doesn't have a value when attr is null
unless attr is undefined

0 comments on commit 4216330

Please sign in to comment.