You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/08/09 14:31:20 UTC
svn commit: r983613 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/context/
tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
tobago-theme/tobago-them...
Author: lofwyr
Date: Mon Aug 9 12:31:19 2010
New Revision: 983613
URL: http://svn.apache.org/viewvc?rev=983613&view=rev
Log:
TOBAGO-789: IE resets the selection in the select element when the select element gets focus via label.
- Fix is only needed for IE6, not for IE 7 or later
Removed:
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie_6_0/script/tobago.js
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java?rev=983613&r1=983612&r2=983613&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java Mon Aug 9 12:31:19 2010
@@ -124,6 +124,10 @@ public class UserAgent implements Serial
return MSIE.name.equals(name);
}
+ public boolean isMsie6() {
+ return MSIE_6_0.name.equals(name) && MSIE_6_0.version.equals(version);
+ }
+
public boolean isMozilla() {
return MOZILLA.name.equals(name);
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-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/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java?rev=983613&r1=983612&r2=983613&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java Mon Aug 9 12:31:19 2010
@@ -80,7 +80,7 @@ public class SelectOneChoiceRenderer ext
}
// TOBAGO-789
- if (VariableResolverUtils.resolveClientProperties(facesContext).getUserAgent().isMsie()) {
+ if (VariableResolverUtils.resolveClientProperties(facesContext).getUserAgent().isMsie6()) {
writer.writeAttribute(HtmlAttributes.ONFOCUSIN, "Tobago.fixSelectionOnFocusIn()", false);
writer.writeAttribute(HtmlAttributes.ONFOCUS, "Tobago.fixSelectionOnFocus()", false);
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie_6_0/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie_6_0/script/tobago.js?rev=983613&r1=983612&r2=983613&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie_6_0/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie_6_0/script/tobago.js Mon Aug 9 12:31:19 2010
@@ -83,6 +83,32 @@ Tobago.workaroundBackgroundPngAlpha = fu
label.css("background-image", "none");
};
+/* TOBAGO-789 */
+Tobago.fixSelectionOnFocusIn = function() {
+ try {
+ var src = window.event.srcElement;
+ if (src) {
+ src.tmpIndex = src.selectedIndex;
+ }
+ } catch (e) {
+ // ignore
+ }
+};
+
+/* TOBAGO-789 */
+Tobago.fixSelectionOnFocus = function() {
+ try {
+ var src = window.event.srcElement;
+ if (src) {
+ src.selectedIndex = src.tmpIndex;
+ }
+ } catch (e) {
+ // ignore
+ }
+};
+
+// init /////////////////////////////////////////////////////////////////////////////////////////////
+
$(document).ready(function() {
Tobago.fixPngAlphaAll();
});