from fredj: "in lib/OpenLayers/Layer.js and lib/OpenLayers/Control.js the div

id is not passed to the createDiv() function." (Closes #1015)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@4677 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-09-30 16:41:42 +00:00
parent 33f85eeb35
commit 01154beb5d
3 changed files with 8 additions and 7 deletions

View File

@@ -170,8 +170,7 @@ OpenLayers.Control = OpenLayers.Class({
*/ */
draw: function (px) { draw: function (px) {
if (this.div == null) { if (this.div == null) {
this.div = OpenLayers.Util.createDiv(); this.div = OpenLayers.Util.createDiv(this.id);
this.div.id = this.id;
this.div.className = this.displayClass; this.div.className = this.displayClass;
} }
if (px != null) { if (px != null) {

View File

@@ -32,10 +32,10 @@ OpenLayers.Layer = OpenLayers.Class({
* Constant: EVENT_TYPES * Constant: EVENT_TYPES
* {Array(String)} Supported application event types * {Array(String)} Supported application event types
*/ */
EVENT_TYPES: [ "loadstart", "loadend", "loadcancel", "visibilitychanged"], EVENT_TYPES: ["loadstart", "loadend", "loadcancel", "visibilitychanged"],
/** /**
* APIProperty: events`` * APIProperty: events
* {<OpenLayers.Events>} * {<OpenLayers.Events>}
*/ */
events: null, events: null,
@@ -238,10 +238,9 @@ OpenLayers.Layer = OpenLayers.Class({
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
this.div = OpenLayers.Util.createDiv(); this.div = OpenLayers.Util.createDiv(this.id);
this.div.style.width = "100%"; this.div.style.width = "100%";
this.div.style.height = "100%"; this.div.style.height = "100%";
this.div.id = this.id;
this.events = new OpenLayers.Events(this, this.div, this.events = new OpenLayers.Events(this, this.div,
this.EVENT_TYPES); this.EVENT_TYPES);

View File

@@ -5,7 +5,7 @@
var layer; var layer;
function test_01_Layer_constructor (t) { function test_01_Layer_constructor (t) {
t.plan( 13 ); t.plan( 15 );
var options = { chicken: 151, foo: "bar", projection: "none" }; var options = { chicken: 151, foo: "bar", projection: "none" };
var layer = new OpenLayers.Layer('Test Layer', options); var layer = new OpenLayers.Layer('Test Layer', options);
@@ -19,6 +19,9 @@
t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" ); t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" );
t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" ); t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" );
t.ok( typeof layer.div == "object" , "layer.div is created" );
t.eq( layer.div.id, layer.id, "layer.div.id is correct" );
options.chicken = 552; options.chicken = 552;
t.eq( layer.options["chicken"], 151 , "layer.options correctly made fresh copy" ); t.eq( layer.options["chicken"], 151 , "layer.options correctly made fresh copy" );