Remove collection {insert,remove,set}_at callbacks

This commit is contained in:
Tom Payne
2012-08-02 16:49:04 +02:00
parent 1b8132ecfd
commit a96982f112
2 changed files with 3 additions and 12 deletions

View File

@@ -157,9 +157,6 @@ ol.Collection.prototype.insertAt = function(index, elem) {
ol.CollectionEventType.ADD, elem, undefined, undefined, this));
this.dispatchEvent(new ol.CollectionEvent(
ol.CollectionEventType.INSERT_AT, elem, index, undefined, this));
if (this[ol.CollectionEventType.INSERT_AT]) {
this[ol.CollectionEventType.INSERT_AT](index);
}
};
@@ -194,9 +191,6 @@ ol.Collection.prototype.removeAt = function(index) {
ol.CollectionEventType.REMOVE, prev, undefined, undefined, this));
this.dispatchEvent(new ol.CollectionEvent(ol.CollectionEventType.REMOVE_AT,
undefined, index, prev, this));
if (this[ol.CollectionEventType.REMOVE_AT]) {
this[ol.CollectionEventType.REMOVE_AT](index);
}
return prev;
};
@@ -216,9 +210,6 @@ ol.Collection.prototype.setAt = function(index, elem) {
prev, undefined, undefined, this));
this.dispatchEvent(new ol.CollectionEvent(ol.CollectionEventType.ADD,
elem, undefined, undefined, this));
if (this[ol.CollectionEventType.SET_AT]) {
this[ol.CollectionEventType.SET_AT](index, prev);
}
} else {
var j;
for (j = n; j < index; ++j) {

View File

@@ -128,9 +128,9 @@ function testInsertAtEvent() {
function testSetAtBeyondEnd() {
var collection = new ol.Collection();
var inserts = [];
collection.insert_at = function(index) {
inserts.push(index);
};
goog.events.listen(collection, ol.CollectionEventType.INSERT_AT, function(e) {
inserts.push(e.index);
});
collection.setAt(2, 0);
assertEquals(3, collection.getLength());
assertUndefined(collection.getAt(0));