diff --git a/lib/OpenLayers/Layer/WFS.js b/lib/OpenLayers/Layer/WFS.js index 3e3f70a1fa..73653b248f 100644 --- a/lib/OpenLayers/Layer/WFS.js +++ b/lib/OpenLayers/Layer/WFS.js @@ -83,22 +83,28 @@ OpenLayers.Layer.WFS.prototype = }, /** - * @param {String} name - * @param {hash} params - * - * @returns A clone of this OpenLayers.Layer.WMS, with the passed-in - * parameters merged in. - * @type OpenLayers.Layer.WMS - */ - clone: function (name, params) { - var mergedParams = {} - Object.extend(mergedParams, this.params); - Object.extend(mergedParams, params); - var obj = new OpenLayers.Layer.WFS(name, this.url, mergedParams); - if (this.tileSize) - obj.setTileSize(this.tileSize); + * @param {Object} obj + * + * @returns An exact clone of this OpenLayers.Layer.WMS + * @type OpenLayers.Layer.WMS + */ + clone: function (obj) { + + if (obj == null) { + obj = new OpenLayers.Layer.WFS(this.name, + this.url, + this.params, + this.options); + } + + //get all additions from superclasses + obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]); + + // copy/set any non-init, non-simple values here + return obj; - }, + }, + /** * addTile creates a tile, initializes it (via 'draw' in this case), and