You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2010/04/19 23:39:00 UTC

svn commit: r935753 - in /myfaces/trinidad/branches/jsf2_ajax.3: ./ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java

Author: arobinson74
Date: Mon Apr 19 21:39:00 2010
New Revision: 935753

URL: http://svn.apache.org/viewvc?rev=935753&view=rev
Log:
Merge of revision 933377 onto the branch

Modified:
    myfaces/trinidad/branches/jsf2_ajax.3/   (props changed)
    myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java

Propchange: myfaces/trinidad/branches/jsf2_ajax.3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Apr 19 21:39:00 2010
@@ -7,4 +7,4 @@
 /myfaces/trinidad/branches/jwaldman_StyleMap:754977-770778
 /myfaces/trinidad/branches/trinidad-1.2.x:923447,923460,929241
 /myfaces/trinidad/branches/trinidad-2.0.x:823098-895949
-/myfaces/trinidad/trunk:819601,819622,834147,886881,888973,893043,896231-908455,908699-921461,929242
+/myfaces/trinidad/trunk:819601,819622,834147,886881,888973,893043,896231-908455,908699-921461,929242,933377

Modified: myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java?rev=935753&r1=935752&r2=935753&view=diff
==============================================================================
--- myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java (original)
+++ myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java Mon Apr 19 21:39:00 2010
@@ -694,11 +694,6 @@ public class XhtmlUtils
     else if (!hasUserHandler && !hasHandler && hasBehaviors && data.behaviorScripts.size() == 1)
     {
       script = data.behaviorScripts.get(0);
-      if ("action".equals(secondaryEventName) && data.submitting)
-      {
-        // prevent the default click action if submitting
-        script += ";return false;";
-      }
     }
     else
     {
@@ -709,7 +704,6 @@ public class XhtmlUtils
       if (hasUserHandler) { ++length; }
       String[] scripts = new String[length];
       int index = 0;
-      boolean submitting = false;
       if (hasUserHandler)
       {
         scripts[0] = userHandlerScript;
@@ -728,11 +722,6 @@ public class XhtmlUtils
       }
 
       script = getChainedJS(true, scripts);
-      if (submitting && "click".equals(eventName))
-      {
-        // prevent the default click action if submitting
-        script += ";return false;";
-      }
     }
 
     return script;
@@ -762,8 +751,7 @@ public class XhtmlUtils
     {
       // if params are not null, a submitting behavior was found in a previous call to this
       // function, so we do not need to check for submitting here
-      data.submitting = data.submitting || _hasSubmittingBehavior(behaviors);
-      if (data.params == null && data.submitting)
+      if (data.params == null && _hasSubmittingBehavior(behaviors))
       {
         // We only need to gather the parameters if there is a submitting behavior, so do
         // not incur the performance overhead if not needed
@@ -780,7 +768,15 @@ public class XhtmlUtils
 
       for (ClientBehavior behavior : behaviors)
       {
-        data.behaviorScripts.add(behavior.getScript(behaviorContext));
+        String behaviorScript = behavior.getScript(behaviorContext);
+        if (data.params != null && // if there are no params, there are no submitting behaviors,
+          // so do not check
+          behavior.getHints().contains(ClientBehaviorHint.SUBMITTING)
+          && ("action".equals(eventName) || "click".equals(eventName)))
+        {
+          behaviorScript += ";return false"; // prevent any further JS execution
+        }
+        data.behaviorScripts.add(behaviorScript);
       }
     }
   }
@@ -802,7 +798,6 @@ public class XhtmlUtils
   {
     Collection<ClientBehaviorContext.Parameter> params;
     List<String>                                behaviorScripts;
-    boolean                                     submitting;
   }
 
   private static final Object _CLIENT_BEHAVIORS_KEY = new Object();