[Mapbender-commits] r7186 - trunk/mapbender/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Dec 3 10:10:22 EST 2010


Author: christoph
Date: 2010-12-03 07:10:22 -0800 (Fri, 03 Dec 2010)
New Revision: 7186

Modified:
   trunk/mapbender/lib/backwards_compatibility_to_2.6.js
Log:
mb_arrangeElement now also accepts DOM node, not only string with ID

Modified: trunk/mapbender/lib/backwards_compatibility_to_2.6.js
===================================================================
--- trunk/mapbender/lib/backwards_compatibility_to_2.6.js	2010-12-03 08:18:50 UTC (rev 7185)
+++ trunk/mapbender/lib/backwards_compatibility_to_2.6.js	2010-12-03 15:10:22 UTC (rev 7186)
@@ -88,20 +88,26 @@
 }
 
 function mb_arrangeElement(frameName, elName, left, top) {
-   if(frameName){
-      window.frames[frameName].document.getElementById(elName).style.top = String(top) + "px";
-      window.frames[frameName].document.getElementById(elName).style.left = String(left) + "px";
-   }
-   else{
-      try {
-	      var s = document.getElementById(elName);
-		  s.style.position = "absolute";
-		  s.style.top = String(top) + "px";
-	      s.style.left = String(left) + "px";   
-      }
-      catch (exc) {
-      }
-   }
+	var el;
+	if (typeof elName === "string") {
+		if (frameName) {
+			el = window.frames[frameName].document.getElementById(elName);
+		}
+		else {
+			el = document.getElementById(elName);
+		}
+	}
+	else if (typeof elName === "object") {
+		el = elName;
+	}
+	else {
+		return;
+	}
+	if (el !== null) {
+		el.style.position = "absolute";
+		el.style.top = String(top) + "px";
+		el.style.left = String(left) + "px";
+	}
 }
 
 var ie = $.browser.msie;



More information about the Mapbender_commits mailing list