fixing bug introduced with [179]. basically, the Layer constructor should not be making new divs when it is initialized by a subclass. that was the point of [179]. the problem is that because of the way Layer.Grid is making the call to Layer's initialize() -- createing a new arguments array regardless of the orginal (ie although name is void, it nonetheless creates a new array with one element, a void element) well so then when init gets called it thinks it does have arguments. The real god's truth here is that we need a better way than if (arguments.length > 0) to distinguish between actual object creation and the creation of the classes.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@185 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -16,11 +16,13 @@ OpenLayers.Layer.prototype = {
|
|||||||
* @param {str} name
|
* @param {str} name
|
||||||
*/
|
*/
|
||||||
initialize: function(name) {
|
initialize: function(name) {
|
||||||
this.name = name;
|
if (arguments.length > 0) {
|
||||||
if (this.div == null) {
|
this.name = name;
|
||||||
this.div = OpenLayers.Util.createDiv();
|
if (this.div == null) {
|
||||||
this.div.style.width = "100%";
|
this.div = OpenLayers.Util.createDiv();
|
||||||
this.div.style.height = "100%";
|
this.div.style.width = "100%";
|
||||||
|
this.div.style.height = "100%";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,11 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
|||||||
* @param {hash} params
|
* @param {hash} params
|
||||||
*/
|
*/
|
||||||
initialize: function(name, url, params) {
|
initialize: function(name, url, params) {
|
||||||
OpenLayers.Layer.prototype.initialize.apply(this, [name]);
|
var newArguments = arguments;
|
||||||
|
if (arguments.length > 0) {
|
||||||
|
newArguments = [name];
|
||||||
|
}
|
||||||
|
OpenLayers.Layer.prototype.initialize.apply(this, newArguments);
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user