[OpenLayers-Commits] r10879 - in trunk/openlayers:
lib/OpenLayers/Strategy tests/Strategy
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Tue Nov 9 07:57:06 EST 2010
Author: bartvde
Date: 2010-11-09 04:57:06 -0800 (Tue, 09 Nov 2010)
New Revision: 10879
Modified:
trunk/openlayers/lib/OpenLayers/Strategy/Filter.js
trunk/openlayers/tests/Strategy/Filter.html
Log:
Filter strategy constructor should not need filter, r=tschaub,fredj (closes #2841)
Modified: trunk/openlayers/lib/OpenLayers/Strategy/Filter.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Strategy/Filter.js 2010-11-08 12:26:40 UTC (rev 10878)
+++ trunk/openlayers/lib/OpenLayers/Strategy/Filter.js 2010-11-09 12:57:06 UTC (rev 10879)
@@ -45,14 +45,10 @@
*
* Parameters:
* options - {Object} Optional object whose properties will be set on the
- * instance. Strategy must be constructed with at least a <filter>
- * property.
+ * instance.
*/
initialize: function(options) {
OpenLayers.Strategy.prototype.initialize.apply(this, [options]);
- if (!this.filter || !(this.filter instanceof OpenLayers.Filter)) {
- throw new Error("Filter strategy must be constructed with a filter");
- }
},
/**
@@ -102,7 +98,7 @@
* Method: handleAdd
*/
handleAdd: function(event) {
- if (!this.caching) {
+ if (!this.caching && this.filter) {
var features = event.features;
event.features = [];
var feature;
Modified: trunk/openlayers/tests/Strategy/Filter.html
===================================================================
--- trunk/openlayers/tests/Strategy/Filter.html 2010-11-08 12:26:40 UTC (rev 10878)
+++ trunk/openlayers/tests/Strategy/Filter.html 2010-11-09 12:57:06 UTC (rev 10879)
@@ -21,7 +21,7 @@
function test_initialize(t) {
- t.plan(3);
+ t.plan(4);
var strategy = new OpenLayers.Strategy.Filter({filter: filter});
@@ -31,6 +31,14 @@
t.ok(strategy.filter === filter, "has filter");
strategy.destroy();
+
+ try {
+ strategy = new OpenLayers.Strategy.Filter();
+ t.ok(true, "strategy without filter works");
+ } catch (err) {
+ t.fail("strategy without filter should not throw");
+ }
+
}
More information about the Commits
mailing list