OpenLayers OpenLayers

Ticket #1015: createDiv.00.patch

File createDiv.00.patch, 2.5 kB (added by fredj, 1 year ago)
  • tests/test_Layer.html

    old new  
    55    var layer;  
    66 
    77    function test_01_Layer_constructor (t) { 
    8         t.plan( 13 ); 
     8        t.plan( 15 ); 
    99         
    1010        var options = { chicken: 151, foo: "bar", projection: "none" }; 
    1111        var layer = new OpenLayers.Layer('Test Layer', options); 
     
    1919        t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" ); 
    2020        t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" ); 
    2121 
     22        t.ok( typeof layer.div == "object" , "layer.div is created" ); 
     23        t.eq( layer.div.id, layer.id, "layer.div.id is correct" ); 
     24 
    2225        options.chicken = 552; 
    2326         
    2427        t.eq( layer.options["chicken"], 151 , "layer.options correctly made fresh copy" ); 
  • lib/OpenLayers/Layer.js

    old new  
    3232     * Constant: EVENT_TYPES 
    3333     * {Array(String)} Supported application event types 
    3434     */ 
    35     EVENT_TYPES: [ "loadstart", "loadend", "loadcancel", "visibilitychanged"], 
     35    EVENT_TYPES: ["loadstart", "loadend", "loadcancel", "visibilitychanged"], 
    3636         
    3737    /** 
    38      * APIProperty: events`` 
     38     * APIProperty: events 
    3939     * {<OpenLayers.Events>} 
    4040     */ 
    4141    events: null, 
     
    238238 
    239239            this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); 
    240240 
    241             this.div = OpenLayers.Util.createDiv(); 
     241            this.div = OpenLayers.Util.createDiv(this.id); 
    242242            this.div.style.width = "100%"; 
    243243            this.div.style.height = "100%"; 
    244             this.div.id = this.id; 
    245244 
    246245            this.events = new OpenLayers.Events(this, this.div,  
    247246                                                this.EVENT_TYPES); 
  • lib/OpenLayers/Control.js

    old new  
    166166     */ 
    167167    draw: function (px) { 
    168168        if (this.div == null) { 
    169             this.div = OpenLayers.Util.createDiv(); 
    170             this.div.id = this.id; 
     169            this.div = OpenLayers.Util.createDiv(this.id); 
    171170            this.div.className = this.displayClass; 
    172171        } 
    173172        if (px != null) {