final patch for #510 -- new datastructure suggested and implemented by james for the events entry cache. speeds up all event operations

git-svn-id: http://svn.openlayers.org/trunk/openlayers@2896 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-03-26 17:33:35 +00:00
parent d82108c2d7
commit 87977f7bfe
3 changed files with 58 additions and 28 deletions

View File

@@ -204,18 +204,19 @@
function test_05_Event_destroy (t) {
t.plan(2);
var start = OpenLayers.Event.observers.length;
var div = OpenLayers.Util.getElement('test');
var obj = {};
var events = new OpenLayers.Events(obj, div);
// +1 because of blocking dragstart in attachToElement()
t.eq(OpenLayers.Event.observers.length,
start + OpenLayers.Events.prototype.BROWSER_EVENTS.length + 1,
"construction increases the number of event observers");
t.eq(OpenLayers.Event.observers["test"].length,
OpenLayers.Events.prototype.BROWSER_EVENTS.length + 1,
"construction creates new arrayin hash, registers appropriate events");
events.destroy();
events = null;
t.eq(OpenLayers.Event.observers.length, start,
"destruction restores the number of event observers");
t.eq(OpenLayers.Event.observers["test"], null,
"destruction removes the event observer from hash");
}
// -->