You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gr...@apache.org on 2007/08/14 23:02:23 UTC

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

Author: grantsmith
Date: Tue Aug 14 14:02:22 2007
New Revision: 565911

URL: http://svn.apache.org/viewvc?view=rev&rev=565911
Log:
patch applied for TOMAHAWK-726

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=565911&r1=565910&r2=565911
==============================================================================
--- 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 Tue Aug 14 14:02:22 2007
@@ -1308,6 +1308,29 @@
     }
 }
 
+org_apache_myfaces_PopupCalendar.prototype._getStyle = function(ctl, property)
+{
+	var value = null;
+	
+	// local style
+	if (ctl.style[property]) {
+       value = ctl.style[property];
+    }
+    // IE syntax
+    else if (ctl.currentStyle && ctl.currentStyle[property]) {
+       value = ctl.currentStyle[property];
+    }
+    // DOM syntax
+    else if ( document.defaultView && document.defaultView.getComputedStyle ) {
+       var computed = document.defaultView.getComputedStyle(ctl, '');
+       
+       if (computed && computed.getPropertyValue(property)) {
+          value = computed.getPropertyValue(property);
+       }
+    }			
+	return value;
+}
+
 org_apache_myfaces_PopupCalendar.prototype._popUpCalendar_Show = function(ctl)
 {
     this.saveSelectedDate.date = this.selectedDate.date;
@@ -1318,6 +1341,7 @@
     var toppos = 0;
 
     var aTag = ctl;
+    var aCSSPosition = null;
     var aTagPositioningisAbsolute = false;
     // Added try-catch to the next loop (MYFACES-870)
     try
@@ -1326,9 +1350,10 @@
             aTag = aTag.offsetParent;
             leftpos += aTag.offsetLeft;
             toppos += aTag.offsetTop;
-            aTagPositioningisAbsolute = (aTag.style.position == "absolute")
+            aCSSPosition = this._getStyle(aTag, 'position');
+            aTagPositioningisAbsolute = (aCSSPosition == "absolute" || aCSSPosition == "relative")
         }
-        while ((aTag.tagName != "BODY") && (aTag.tagName != "DIV") && (!aTagPositioningisAbsolute));
+        while ((aTag.offsetParent) && (!aTagPositioningisAbsolute));
     }
     catch (ex)
     {
@@ -1345,9 +1370,10 @@
         do {
             leftScrollOffset += aTag.scrollLeft;
             topScrollOffset += aTag.scrollTop;
+            aCSSPosition = this._getStyle(aTag, 'position');
             aTag = aTag.parentNode;
         }
-        while ((aTag.tagName != "BODY") && (aTag.tagName != "DIV") && (aTag.style.position != "absolute"));
+        while ((aTag.tagName.toUpperCase() != "BODY") && (aTag.tagName.toUpperCase() != "HTML") && (aCSSPosition != "absolute" || aCSSPosition == "relative"));
     }
     catch (ex)
     {