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 2010/04/07 08:26:54 UTC

svn commit: r931443 - /myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js

Author: werpu
Date: Wed Apr  7 06:26:53 2010
New Revision: 931443

URL: http://svn.apache.org/viewvc?rev=931443&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-2640
I changed the code to the fragment return in case of the fragment being exactly one root node,
because tests revealed that for extremely complex structures node replacement be fragment subnodes
can be problematic, since the eg recommends anyway to have one root node with the clientId being the id
the change we did still can be left in, but the normal case must be covered in the most stable way and that
is using the fragment instead of its childNodes!




Modified:
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js?rev=931443&r1=931442&r2=931443&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js Wed Apr  7 06:26:53 2010
@@ -293,7 +293,14 @@ if (!myfaces._impl._util._LangUtils.exis
     myfaces._impl._util._Utils.findHtmlItemFromFragment = function(fragment, itemId) {
         if (fragment.childNodes == null)
             return null;
-        
+        //normal usecase, some browsers behave saner in complex situations if we work directly
+        //on the fragment, since the recommended path from the eg is to use an outer element
+        //having the id, this is the normal usecase
+        if(fragment.childNodes.length == 1 && fragment.childNodes[0].id == itemId) {
+            return fragment;
+        }
+
+        //subfragment usecases
         for (var i = 0; i < fragment.childNodes.length; i++) {
             var c = fragment.childNodes[i];
             if (c.id == itemId)