diff --git a/lib/OpenLayers/BaseTypes.js b/lib/OpenLayers/BaseTypes.js index edcf84db3a..695ac9d034 100644 --- a/lib/OpenLayers/BaseTypes.js +++ b/lib/OpenLayers/BaseTypes.js @@ -32,7 +32,7 @@ OpenLayers.Class = { // // to be revisited in 3.0 // - if (arguments[i].toString) { + if (arguments[i].hasOwnProperty('toString')) { proto.toString = arguments[i].toString; } } diff --git a/lib/OpenLayers/Geometry/Collection.js b/lib/OpenLayers/Geometry/Collection.js index e932b03221..cc579cca5c 100644 --- a/lib/OpenLayers/Geometry/Collection.js +++ b/lib/OpenLayers/Geometry/Collection.js @@ -46,6 +46,15 @@ OpenLayers.Geometry.Collection.prototype = this.components = null; }, + /** + * @returns The coordinates components as a string + * @type String + */ + toString: function() { + return this.components.toString(); + }, + + /** * @returns An exact clone of this collection * @type OpenLayers.Geometry.Collection diff --git a/lib/OpenLayers/Geometry/LineString.js b/lib/OpenLayers/Geometry/LineString.js index 43aaf03257..ae7910ec69 100644 --- a/lib/OpenLayers/Geometry/LineString.js +++ b/lib/OpenLayers/Geometry/LineString.js @@ -24,14 +24,6 @@ OpenLayers.Geometry.LineString.prototype = arguments); }, - /** - * @returns The coordinates components as a string - * @type String - */ - toString: function() { - return this.components.toString(); - }, - /** * @returns An exact clone of this OpenLayers.Feature * @type OpenLayers.Feature diff --git a/lib/OpenLayers/Geometry/LinearRing.js b/lib/OpenLayers/Geometry/LinearRing.js index 78aec0620d..e8a2f58d55 100644 --- a/lib/OpenLayers/Geometry/LinearRing.js +++ b/lib/OpenLayers/Geometry/LinearRing.js @@ -108,15 +108,6 @@ OpenLayers.Geometry.LinearRing.prototype = return area; }, - - /** - * @returns The coordinates components as a string - * @type String - */ - toString: function() { - return this.components.toString(); - }, - /** @final @type String */ CLASS_NAME: "OpenLayers.Geometry.LinearRing" });