From 9f9feabfae29a41e8dbeb49c363c5fe8cc6be3e1 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Sat, 21 Jan 2012 10:46:44 +0100 Subject: [PATCH] Let's not over-engineer things (see #164). --- lib/OpenLayers/Events/buttonclick.js | 17 ++++------------- tests/Events/buttonclick.html | 4 +--- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/lib/OpenLayers/Events/buttonclick.js b/lib/OpenLayers/Events/buttonclick.js index 823586cac3..6b8e16cdeb 100644 --- a/lib/OpenLayers/Events/buttonclick.js +++ b/lib/OpenLayers/Events/buttonclick.js @@ -64,20 +64,11 @@ OpenLayers.Events.buttonclick = OpenLayers.Class({ * instances. * * Parameters: - * options - {|Object} Target instance of - * or configuration properties for this - * instance. - * - * Required configuration properties: * target - {} The events instance that the buttonclick * event will be triggered on. */ - initialize: function(options) { - if (options instanceof OpenLayers.Events) { - options = {target: options}; - } - OpenLayers.Util.extend(this, options); - + initialize: function(target) { + this.target = target; for (var i=this.events.length-1; i>=0; --i) { this.target.register(this.events[i], this, this.buttonClick, { extension: true @@ -118,12 +109,12 @@ OpenLayers.Events.buttonclick = OpenLayers.Class({ if (this.cancelRegEx.test(evt.type)) { delete this._buttonStarted; } - OpenLayers.Event.stop(evt, false); + OpenLayers.Event.stop(evt); propagate = false; } if (this.startRegEx.test(evt.type)) { this._buttonStarted = true; - OpenLayers.Event.stop(evt, false); + OpenLayers.Event.stop(evt); propagate = false; } } else { diff --git a/tests/Events/buttonclick.html b/tests/Events/buttonclick.html index ab0c0777d5..9aff9b89b8 100644 --- a/tests/Events/buttonclick.html +++ b/tests/Events/buttonclick.html @@ -20,10 +20,8 @@ } function test_ButtonClick(t) { - t.plan(2); + t.plan(1); events = new OpenLayers.Events({}, element); - buttonClick = new OpenLayers.Events.buttonclick({target: events}); - t.ok(buttonClick.target === events, "target set from options argument"); buttonClick = new OpenLayers.Events.buttonclick(events); t.ok(buttonClick.target === events, "target set from constructor arg"); buttonClick.destroy();