Skip to content

Commit

Permalink
Fixed a bug in the SparseArray API where a delegate will instantiate …
Browse files Browse the repository at this point in the history
…a empty function for sparseArrayDidRequestIndexOf in the default case. This always falls back to looking locally
  • Loading branch information
etgryphon committed Aug 3, 2011
1 parent d88636e commit a8ba161
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions frameworks/core_foundation/system/sparse_array.js
Expand Up @@ -314,15 +314,18 @@ SC.SparseArray = SC.Object.extend(SC.Observable, SC.Enumerable, SC.Array,
@returns {Number} the discovered index or -1 if not found
*/
indexOf: function(obj) {
var del = this.delegate ;
var c, ret, del = this.delegate ;
if (del && del.sparseArrayDidRequestIndexOf) {
return del.sparseArrayDidRequestIndexOf(this, obj);
} else {
var content = this._sa_content ;
if (!content) content = this._sa_content = [] ;
return content.indexOf(obj) ;
ret = del.sparseArrayDidRequestIndexOf(this, obj);
}

if (SC.none(ret)) {
c = this._sa_content ;
if (!c) c = this._sa_content = [] ;
ret = c.indexOf(obj) ;
}
},
return ret;
},

// ..........................................................
// EDITING
Expand Down

0 comments on commit a8ba161

Please sign in to comment.