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/07/02 12:14:52 UTC

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

Author: werpu
Date: Fri Jul  2 10:14:52 2010
New Revision: 959935

URL: http://svn.apache.org/viewvc?rev=959935&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-2761
minor performance fix for the last commits

added ie fixes


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

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js?rev=959935&r1=959934&r2=959935&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js Fri Jul  2 10:14:52 2010
@@ -402,19 +402,23 @@ myfaces._impl.core._Runtime.singletonExt
      * this should work out with elements with different nesting depths but not being
      * parent and child to each other
      *
-     * TODO rename to getElementsByTagName
-     * TODO add iterator handlers here for browsers which allow dom filters and iterators
+     * @return the child elements as array or null if nothing is found
+     *
      */
     findByTagName : function(fragment, tagName, deepScan) {
         var _Lang = myfaces._impl._util._Lang;
 
         deepScan = !!deepScan;
 
-        //elements by tagname is the fastest
+        //elements by tagname is the fastest, ie throws an error on fragment.getElementsByTagName, the exists type
+        //via namespace array checking is safe
         if (deepScan && _Lang.exists(fragment, "getElementsByTagName")) {
             var ret = _Lang.objToArray(fragment.getElementsByTagName(tagName));
             if(fragment.tagName && fragment.tagName.toLowerCase() == tagName.toLocaleLowerCase()) ret.unshift(fragment);
             return ret;
+        } else if(deepScan) {
+            //no node type with child tags we can handle that without node type checking
+            return null;
         }
         //since getElementsByTagName is a standardized dom node function and ie also supports
         //it since 5.5