myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r808492 - in /myfaces/tobago/trunk/theme: scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/
Date Thu, 27 Aug 2009 16:21:12 GMT
Author: bommel
Date: Thu Aug 27 16:21:10 2009
New Revision: 808492

URL: http://svn.apache.org/viewvc?rev=808492&view=rev
Log:
(TOBAGO-789) IE resets the selection in the select element when the select element gets focus
via label

Modified:
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java?rev=808492&r1=808491&r2=808492&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java
(original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java
Thu Aug 27 16:21:10 2009
@@ -29,6 +29,7 @@
 import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
 import org.apache.myfaces.tobago.util.ComponentUtil;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.apache.myfaces.tobago.context.ClientProperties;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -84,6 +85,11 @@
     if (onchange != null) {
       writer.writeAttribute(HtmlAttributes.ONCHANGE, onchange, true);
     }
+    
+    if (ClientProperties.getInstance(facesContext.getViewRoot()).getUserAgent().isMsie())
{
+      writer.writeAttribute("onfocusin", "Tobago.fixSelectionOnFocusIn()", false);
+      writer.writeAttribute("onfocus", "Tobago.fixSelectionOnFocus()", false);
+    }
     Object[] values = {selectOne.getValue()};
 
     HtmlRendererUtil.renderSelectItems(selectOne, items, values, writer, facesContext);

Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js?rev=808492&r1=808491&r2=808492&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js
(original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js
Thu Aug 27 16:21:10 2009
@@ -84,4 +84,26 @@
     // remove filter
     element.runtimeStyle.filter = "";
   }
+};
+
+Tobago.fixSelectionOnFocusIn = function() {
+  try {
+    var src = window.event.srcElement;
+    if (src) {
+      src.tmpIndex = src.selectedIndex;
+    }
+  } catch (e) {
+     // ignore
+  }
+};
+
+Tobago.fixSelectionOnFocus = function() {
+  try {
+    var src = window.event.srcElement;
+    if (src) {
+      src.selectedIndex = src.tmpIndex;
+     }
+  } catch (e) {
+    // ignore
+  }
 };
\ No newline at end of file



Mime
View raw message