OpenLayers OpenLayers

Changeset 2645

Show
Ignore:
Timestamp:
03/09/07 16:54:41 (2 years ago)
Author:
sderle
Message:

Switch to sequential ID numbering. Fixes #226.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Util.js

    r2541 r2645  
    623623} 
    624624 
     625OpenLayers.Util.lastSeqID = 0; 
     626 
    625627/** 
    626628 * @param {String} prefix String to prefix random id. If null, default 
     
    634636        prefix = "id_"; 
    635637    } 
    636     return prefix + Math.round(Math.random() * 10000);         
     638    OpenLayers.Util.lastSeqID += 1;  
     639    return prefix + OpenLayers.Util.lastSeqID;         
    637640}; 
    638641 
  • trunk/openlayers/tests/test_Util.html

    r2232 r2645  
    564564  
    565565    } 
    566  
     566    function test_Util_createUniqueIDSeq(t) { 
     567        t.plan(1); 
     568        OpenLayers.Util.lastSeqID = 0; 
     569        OpenLayers.Util.createDiv(); 
     570        OpenLayers.Util.createDiv(); 
     571        t.eq(OpenLayers.Util.createDiv().id, "OpenLayersDiv3", "Div created is sequential, starting at lastSeqID in Util."); 
     572    } 
    567573   // --> 
    568574  </script>