Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix compatibility of attr, fixes #148

  • Loading branch information...
commit a5bf7603f987106400a44be77384a59b28b69508 1 parent f6bd11f
@madrobby madrobby authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  src/zepto.js
  2. +1 −1  test/zepto.html
View
2  src/zepto.js
@@ -182,7 +182,7 @@ var Zepto = (function() {
attr: function(name, value){
return (typeof name == 'string' && value === undefined) ?
(this.length > 0 && this[0].nodeName == 'INPUT' && this[0].type == 'text' && name == 'value') ? (this.val()) :
- (this.length > 0 ? this[0].getAttribute(name) || (name in this[0] ? this[0][name] : undefined) : null) :
+ (this.length > 0 ? this[0].getAttribute(name) || (name in this[0] ? this[0][name] : undefined) : undefined) :
this.each(function(idx){
if (isO(name)) for (key in name) this.setAttribute(key, name[key])
else this.setAttribute(name, isF(value) ? value.call(this, idx, this.getAttribute(name)) : value);
View
2  test/zepto.html
@@ -820,7 +820,7 @@
els.attr("data-id", 0);
t.assertEqual("0", els.attr("data-id"));
- t.assertNull($('doesnotexist').attr('yo'));
+ t.assertUndefined($('doesnotexist').attr('yo'));
els.attr({ 'data-id': 'id', 'data-name': 'name' });
t.assertEqual('id', els.attr("data-id"));
Please sign in to comment.
Something went wrong with that request. Please try again.