JSDOC / coding standards createDiv function
git-svn-id: http://svn.openlayers.org/trunk/openlayers@143 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+15
-17
@@ -521,47 +521,45 @@ Array.prototype.clear = function() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Create a child element (a div currently) that
|
/**
|
||||||
* is a proper child of the supplied parent, is invisible,
|
|
||||||
* positioned as requested within the parent, etc
|
|
||||||
*
|
|
||||||
* zIndex is NOT set
|
* zIndex is NOT set
|
||||||
*
|
*
|
||||||
* @param {str} id - HTML ID of new element, if empty something is made up
|
* @param {String} id - HTML ID of new element, if empty something is made up
|
||||||
* @param {OpenLayers.Pixel} pt - x,y point if missing 0,0 is used
|
* @param {OpenLayers.Pixel} pt - x,y point if missing 0,0 is used
|
||||||
* @param {OpenLayers.Size} sz - size else size of parent is used
|
* @param {OpenLayers.Size} sz - size else size of parent is used
|
||||||
* @param {str} overflow - behavior of clipped/overflow content
|
* @param {String} overflow - behavior of clipped/overflow content
|
||||||
* @param {str} img - background image url
|
* @param {String} img - background image url
|
||||||
* @param {str} position - relative or absolute?
|
* @param {String} position - relative or absolute?
|
||||||
*
|
*
|
||||||
* @return {DOM}
|
* @returns A DOM Div created with the specified attributes.
|
||||||
|
* @type DOMElement
|
||||||
*/
|
*/
|
||||||
OpenLayers.Util.createDiv = function(id, pt, sz, overflow, img, position) {
|
OpenLayers.Util.createDiv = function(id, pt, sz, overflow, img, position) {
|
||||||
var x,y,w,h;
|
var x,y,w,h;
|
||||||
|
|
||||||
if (pt){
|
if (pt) {
|
||||||
x = pt.x;
|
x = pt.x;
|
||||||
y = pt.y;
|
y = pt.y;
|
||||||
} else {
|
} else {
|
||||||
x = y = 0;
|
x = y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!position){
|
if (!position) {
|
||||||
position = "absolute";
|
position = "absolute";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!id){
|
if (!id) {
|
||||||
id = "OpenLayersDiv" + (Math.random()*10000%10000);
|
id = "OpenLayersDiv" + (Math.random() * 10000 % 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
var dom = document.createElement('div');
|
var dom = document.createElement('div');
|
||||||
dom.id = id;
|
dom.id = id;
|
||||||
if (overflow){
|
if (overflow) {
|
||||||
dom.style.overflow = overflow;
|
dom.style.overflow = overflow;
|
||||||
}
|
}
|
||||||
if (sz) {
|
if (sz) {
|
||||||
dom.style.width = sz.w+"px";
|
dom.style.width = sz.w + "px";
|
||||||
dom.style.height = sz.h+"px";
|
dom.style.height = sz.h + "px";
|
||||||
}
|
}
|
||||||
dom.style.position = position;
|
dom.style.position = position;
|
||||||
dom.style.top = y;
|
dom.style.top = y;
|
||||||
@@ -570,7 +568,7 @@ OpenLayers.Util.createDiv = function(id, pt, sz, overflow, img, position) {
|
|||||||
dom.style.margin = "0";
|
dom.style.margin = "0";
|
||||||
dom.style.cursor = "inherit";
|
dom.style.cursor = "inherit";
|
||||||
|
|
||||||
if (img){
|
if (img) {
|
||||||
dom.style.backgroundImage = 'url(' + img + ')';
|
dom.style.backgroundImage = 'url(' + img + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user