You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2006/09/22 00:14:17 UTC

svn commit: r448713 - /myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js

Author: mmarinschek
Date: Thu Sep 21 15:14:17 2006
New Revision: 448713

URL: http://svn.apache.org/viewvc?view=rev&rev=448713
Log:
fix for TOMAHAWK-128 : Incorrect inputCalendar position when placed in DIV tag with position: absolute. Thanks to Mirco Attocchi for providing this patch.

Modified:
    myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js

Modified: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js?view=diff&rev=448713&r1=448712&r2=448713
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js (original)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js Thu Sep 21 15:14:17 2006
@@ -1318,6 +1318,7 @@
     var toppos = 0;
 
     var aTag = ctl;
+    var aTagPositioningisAbsolute = false;
     // Added try-catch to the next loop (MYFACES-870)
     try
     {
@@ -1325,8 +1326,9 @@
             aTag = aTag.offsetParent;
             leftpos += aTag.offsetLeft;
             toppos += aTag.offsetTop;
+            aTagPositioningisAbsolute = (aTag.style.position == "absolute")
         }
-        while (aTag.tagName != "BODY");
+        while ((aTag.tagName != "BODY") && (aTag.tagName != "DIV") && (!aTagPositioningisAbsolute));
     }
     catch (ex)
     {
@@ -1345,7 +1347,7 @@
             topScrollOffset += aTag.scrollTop;
             aTag = aTag.parentNode;
         }
-        while (aTag.tagName != "BODY");
+        while ((aTag.tagName != "BODY") && (aTag.tagName != "DIV") && (aTag.style.position != "absolute"));
     }
     catch (ex)
     {
@@ -1354,8 +1356,17 @@
 
     var bodyRect = this._getVisibleBodyRectangle();
     var cal = this.calendarDiv;
-    var top = ctl.offsetTop + toppos - topScrollOffset + ctl.offsetHeight + 2;
-    var left = ctl.offsetLeft + leftpos - leftScrollOffset;
+    
+    var top = 0;
+    var left = 0
+    if (aTagPositioningisAbsolute) {    
+        top = ctl.offsetTop - topScrollOffset + ctl.offsetHeight + 2;
+        left = ctl.offsetLeft - leftScrollOffset;
+    }
+    else {
+        top = ctl.offsetTop + toppos - topScrollOffset + ctl.offsetHeight + 2;
+        left = ctl.offsetLeft + leftpos - leftScrollOffset;
+    }
 
     if(this.initData.popupLeft)
     {
@@ -1464,4 +1475,5 @@
     return str;
 
 }
+