From a96982f11223f9dda8d5d8e9a0d90888a88d1700 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Thu, 2 Aug 2012 16:49:04 +0200 Subject: [PATCH] Remove collection {insert,remove,set}_at callbacks --- src/ol/base/collection.js | 9 --------- src/ol/base/collection_test.js | 6 +++--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/ol/base/collection.js b/src/ol/base/collection.js index 424c6ebc25..2810e3a492 100644 --- a/src/ol/base/collection.js +++ b/src/ol/base/collection.js @@ -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) { diff --git a/src/ol/base/collection_test.js b/src/ol/base/collection_test.js index 24b0c63228..26dff88534 100644 --- a/src/ol/base/collection_test.js +++ b/src/ol/base/collection_test.js @@ -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));