Skip to content

Commit

Permalink
Pass the element as the context [this] to function arguments for .att…
Browse files Browse the repository at this point in the history
…r() and .html()

as per jQuery...
  • Loading branch information
ekhaled committed Feb 27, 2011
1 parent 0dec5c7 commit 0830112
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/zepto.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ var Zepto = (function() {
html: function(html){
return html === undefined ?
(this.length > 0 ? this[0].innerHTML : null) :
this.each(function(idx){ this.innerHTML = typeof html == 'function' ? html(idx, this.innerHTML) : html });
this.each(function(idx){ this.innerHTML = typeof html == 'function' ? html.call(this, idx, this.innerHTML) : html });
},
text: function(text){
return text === undefined ?
Expand All @@ -140,7 +140,7 @@ var Zepto = (function() {
(this.length > 0 ? this[0].getAttribute(name) || (name in this[0] ? this[0][name] : undefined) : null) :
this.each(function(idx){
if (typeof name == 'object') for (key in name) this.setAttribute(key, name[key])
else this.setAttribute(name, typeof value == 'function' ? value(idx, this.getAttribute(name)) : value);
else this.setAttribute(name, typeof value == 'function' ? value.call(this, idx, this.getAttribute(name)) : value);
});
},
removeAttr: function(name) {
Expand Down

0 comments on commit 0830112

Please sign in to comment.