Skip to content

Commit

Permalink
fix whitespace to follow existing coding convention
Browse files Browse the repository at this point in the history
  • Loading branch information
ekhaled committed May 3, 2011
1 parent bd1903d commit ba3bc18
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/zepto.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var Zepto = (function() {
return selector === undefined ? $(nodes) : $(nodes).filter(selector);
}

function funcArg(context,arg,idx,payload){
function funcArg(context, arg, idx, payload){
return isF(arg) ? arg.call(context, idx, payload) : arg;
}

Expand Down Expand Up @@ -186,7 +186,7 @@ var Zepto = (function() {
html: function(html){
return html === undefined ?
(this.length > 0 ? this[0].innerHTML : null) :
this.each(function(idx){ this.innerHTML = funcArg(this,html,idx,this.innerHTML) });
this.each(function(idx){ this.innerHTML = funcArg(this, html, idx, this.innerHTML) });
},
text: function(text){
return text === undefined ?
Expand All @@ -199,7 +199,7 @@ var Zepto = (function() {
(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, funcArg(this,value,idx,this.getAttribute(name)));
else this.setAttribute(name, funcArg(this, value, idx, this.getAttribute(name)));
});
},
removeAttr: function(name) {
Expand Down Expand Up @@ -242,7 +242,7 @@ var Zepto = (function() {
addClass: function(name){
return this.each(function(idx) {
classList = [];
var cls = this.className, newName = funcArg(this,name,idx,cls);
var cls = this.className, newName = funcArg(this, name, idx, cls);
newName.split(/\s+/g).forEach(function(klass) {
if (!$(this).hasClass(klass)) {
classList.push(klass)
Expand All @@ -254,15 +254,15 @@ var Zepto = (function() {
removeClass: function(name){
return this.each(function(idx) {
classList = this.className;
funcArg(this,name,idx,classList).split(/\s+/g).forEach(function(klass) {
funcArg(this, name, idx, classList).split(/\s+/g).forEach(function(klass) {
classList = classList.replace(classRE(klass), " ")
});
this.className = classList.trim()
})
},
toggleClass: function(name, when){
return this.each(function(idx){
var cls = this.className, newName = funcArg(this,name,idx,cls);
var cls = this.className, newName = funcArg(this, name, idx, cls);
((when !== undefined && !when) || $(this).hasClass(newName)) ?
$(this).removeClass(newName) : $(this).addClass(newName)
});
Expand Down

0 comments on commit ba3bc18

Please sign in to comment.