You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/01/04 10:58:51 UTC

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

Author: skitching
Date: Fri Jan  4 01:58:50 2008
New Revision: 608785

URL: http://svn.apache.org/viewvc?rev=608785&view=rev
Log:
Fix popup calendar to work with Opera 9.x

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?rev=608785&r1=608784&r2=608785&view=diff
==============================================================================
--- 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 Fri Jan  4 01:58:50 2008
@@ -83,7 +83,12 @@
     this.dateFormat="MM/dd/yyyy";
     this.nStartingYear;
     this.bPageLoaded = false;
-    this.ie = document.all;
+
+    // Detect whether the browser is Microsoft Internet Explorer.
+    // Testing for the presence of document.all is not sufficient, as Opera provides that.
+    // However hopefully nothing but IE implements ActiveX..
+    this.ie = window.ActiveXObject ? true : false;
+
     this.dom = document.getElementById;
     this.ns4 = document.layers;
     this.dateFormatSymbols = new org_apache_myfaces_dateformat_DateFormatSymbols();
@@ -131,8 +136,18 @@
 
         if (iframe == null)
         {
-            // the source attribute is to avoid a IE error message about non secure content on https connections
-            iframe = document.createElement("<iframe src='javascript:false;' id='" + overDiv.id + "_IFRAME' style='visibility:hidden; position: absolute; top:0px;left:0px;'/>");
+            if (this.ie)
+            {
+              var cmd = "<iframe src='javascript:false;' id='" + overDiv.id + "_IFRAME' style='visibility:hidden; position: absolute; top:0px;left:0px;'/>";
+              iframe = document.createElement(cmd);
+            }
+            else
+            {
+              iframe = document.createElement("iframe");
+              iframe.id = overDiv.id + "_IFRAME";
+              iframe.style="visibility:hidden; position:absolute; top:0px; left:0px;"
+            }
+
             this.containerCtl.appendChild(iframe);
         }