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

svn commit: r819981 - /myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Author: weber
Date: Tue Sep 29 15:22:17 2009
New Revision: 819981

URL: http://svn.apache.org/viewvc?rev=819981&view=rev
Log:
(TOBAGO-798) Javascript error on openPopup in IE
<https://issues.apache.org/jira/browse/TOBAGO-798>

Modified:
    myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=819981&r1=819980&r2=819981&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Tue Sep 29 15:22:17 2009
@@ -1016,32 +1016,38 @@
     for (var i = 0; i < document.forms[0].elements.length; i++) {
       var element = document.forms[0].elements[i];
       if (element.type != "hidden" && !element.disabled) {
-        if (element.id && element.id.indexOf(id + ":") != 0) {
-         element.disabled = true;
-         hidden.value += element.id + ",";
-       } else {
-         if (firstPopupElement == null && element.focus) {
-           firstPopupElement = element;
-         }
-       }
-     }
+        if (element.id) {
+          if (element.id.indexOf(id + ":") != 0) {
+            element.disabled = true;
+            hidden.value += element.id + ",";
+          } else {
+            if (firstPopupElement == null && Tobago.isFunction(element.focus)) {
+              firstPopupElement = element;
+            }
+          }
+        }
+      }
     }
     for (i = 0; i < document.anchors.length; i++) {
-      var element = document.anchors[i];
-      if (!element.disabled) {
-        if (element.id && element.id.indexOf(id + ":") != 0) {
-         element.disabled = true;
-         hidden.value += element.id + ",";
-       } else {
-         if (firstPopupElement == null && element.focus) {
-           firstPopupElement = element;
-         }
-       }
-     }
+      var anchor = document.anchors[i];
+      if (!anchor.disabled) {
+        if (anchor.id) {
+          if (anchor.id.indexOf(id + ":") != 0) {
+            anchor.disabled = true;
+            hidden.value += anchor.id + ",";
+          } else {
+            if (firstPopupElement == null && Tobago.isFunction(anchor.focus)) {
+              firstPopupElement = anchor;
+            }
+          }
+        }
+      }
     }
     // set focus to first element in popup
     if (firstPopupElement != null) {
-       firstPopupElement.focus();
+      try {
+        firstPopupElement.focus();
+      } catch(e) {/* ignore */}
     }
   },
 
@@ -1139,9 +1145,9 @@
        }
      }
      for (i = 0; i < document.anchors.length; i++) {
-       var element = document.anchors[i];
-       if (hidden.value.indexOf("," + element.id + ",") >= 0) {
-         element.disabled = false;
+       var anchor = document.anchors[i];
+       if (hidden.value.indexOf("," + anchor.id + ",") >= 0) {
+         anchor.disabled = false;
        }
      }
    }