Skip to content

Commit

Permalink
fix attributes()
Browse files Browse the repository at this point in the history
  • Loading branch information
maccman committed Mar 28, 2011
1 parent cb63628 commit f431f8f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/spine.js
Expand Up @@ -43,7 +43,8 @@
if (!(list = this._callbacks[ev])) return this;

for (i = 0, l = list.length; i < l; i++)
list[i].apply(this, args);
if (list[i].apply(this, args) === false)
return false;
return this;
}
};
Expand Down Expand Up @@ -313,7 +314,7 @@

attributes: function(){
var result = {};
for(var i in this.parent.attributes) {
for (var i=0; i < this.parent.attributes.length; i++) {
var attr = this.parent.attributes[i];
result[attr] = this[attr];
}
Expand All @@ -329,8 +330,8 @@
save: function(){
var error = this.validate();
if (error) {
this.trigger("error", error);
return false;
if ( !this.trigger("error", error) )
throw("Validation failed: " + error);
}

this.trigger("beforeSave");
Expand Down Expand Up @@ -450,6 +451,10 @@
for (var key in this.elements) {
this[this.elements[key]] = this.$(key);
}
},

delay: function(func, timeout){
setTimeout(this.proxy(func), timeout || 0);
}
});

Expand Down

0 comments on commit f431f8f

Please sign in to comment.