diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 4cceebd12b..f651cff0e8 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -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 * -* @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.Size} sz - size else size of parent is used -* @param {str} overflow - behavior of clipped/overflow content -* @param {str} img - background image url -* @param {str} position - relative or absolute? +* @param {String} overflow - behavior of clipped/overflow content +* @param {String} img - background image url +* @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) { var x,y,w,h; - if (pt){ + if (pt) { x = pt.x; y = pt.y; } else { x = y = 0; } - if (!position){ + if (!position) { position = "absolute"; } - if (!id){ - id = "OpenLayersDiv" + (Math.random()*10000%10000); + if (!id) { + id = "OpenLayersDiv" + (Math.random() * 10000 % 10000); } var dom = document.createElement('div'); dom.id = id; - if (overflow){ + if (overflow) { dom.style.overflow = overflow; } if (sz) { - dom.style.width = sz.w+"px"; - dom.style.height = sz.h+"px"; + dom.style.width = sz.w + "px"; + dom.style.height = sz.h + "px"; } dom.style.position = position; dom.style.top = y; @@ -570,7 +568,7 @@ OpenLayers.Util.createDiv = function(id, pt, sz, overflow, img, position) { dom.style.margin = "0"; dom.style.cursor = "inherit"; - if (img){ + if (img) { dom.style.backgroundImage = 'url(' + img + ')'; }