Permalink
Browse files

JQuery equivalent removeAttr method.

  • Loading branch information...
Simon Russell
Simon Russell committed Jan 11, 2011
1 parent fe781ad commit d576f1314bb8d6623d995b757ab63be10db230fe
Showing with 15 additions and 0 deletions.
  1. +3 −0 src/zepto.js
  2. +12 −0 test/zepto.html
View
@@ -121,6 +121,9 @@ var Zepto = (function() {
else this.setAttribute(name, value);
});
},
+ removeAttr: function(name) {
+ return this.each(function() { this.removeAttribute(name); });
+ },
val: function(value){
return (value === undefined) ?
(this.length > 0 ? this.dom[0].value : null) :
View
@@ -676,7 +676,19 @@ <h1>Zepto DOM unit tests</h1>
els.attr('value', '');
t.assertEqual(els.get(0).value, els.attr('value'));
t.assertEqual('', els.attr('value'));
+ },
+
+ testRemoveAttr: function(t) {
+ var els = $('#attr_with_text_input');
+
+ els.get(0).removeAttribute('disabled');
+ t.assertEqual(els.attr('disabled'), undefined);
+ els.attr('disabled', 'definitely');
+ t.assertEqual(els.attr('disabled'), 'definitely');
+
+ els.removeAttr('disabled');
+ t.assertEqual(els.attr('disabled'), undefined);
},
testVal: function(t) {

0 comments on commit d576f13

Please sign in to comment.