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/05/15 16:43:00 UTC

svn commit: r944652 - in /myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl: _util/_Dom.js _util/_Lang.js _util/_UnitTest.js core/_Runtime.js

Author: werpu
Date: Sat May 15 14:43:00 2010
New Revision: 944652

URL: http://svn.apache.org/viewvc?rev=944652&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-2716

browser specific performance improvements in the dom area, adding additional comments
fixes for some minor issues where ie8 broke the javascript specs on the closure
array apply area!

Cleaned up the javascript eval code, it now should work faster and is more readable
thanks to our new performance improved dom routines.

Modified:
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Lang.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_UnitTest.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.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=944652&r1=944651&r2=944652&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 Sat May 15 14:43:00 2010
@@ -25,10 +25,12 @@
  * the parts which our impl uses.
  * A jquery like query API would be nice
  * but this would blow up our codebase significantly
- * 
+ *
+ * TODO selector shortcuts bei chrome abdrehen da knallt es
+ *
  */
 myfaces._impl.core._Runtime.singletonExtendClass("myfaces._impl._util._Dom", Object, {
-    _ieQuircksEvents : {
+    IE_QUIRKS_EVENTS : {
         "onabort": true,
         "onload":true,
         "onunload":true,
@@ -56,15 +58,8 @@ myfaces._impl.core._Runtime.singletonExt
      * @param {|Node|} item
      */
     runScripts: function(item) {
-        var childIteration = myfaces._impl._util._Lang.hitch(this, function(item) {
-            var child = item.firstChild;
-            while (child) {
-                this.runScripts(child);
-                child = child.nextSibling;
-            }
-        });
 
-        if (item.nodeType == 1) { // only if it's an element node or document fragment
+        var executeScriptTag = myfaces._impl._util._Lang.hitch(this, function(item) {
             if ('undefined' != typeof item.tagName && item.tagName.toLowerCase() == 'script') {
 
                 if (typeof item.getAttribute('src') != 'undefined'
@@ -94,11 +89,13 @@ myfaces._impl.core._Runtime.singletonExt
                     // we have to run the script under a global context
                     myfaces._impl.core._Runtime.globalEval(test); // run the script
                 }
-            } else {
-                childIteration(item);
             }
-        } else {
-            childIteration(item);
+        });
+
+        var scriptElements = this.findByTagName(item, "script", true);
+        if (scriptElements == null) return;
+        for (var cnt = 0; cnt < scriptElements.length; cnt++) {
+            executeScriptTag(scriptElements[cnt]);
         }
     },
 
@@ -198,10 +195,15 @@ myfaces._impl.core._Runtime.singletonExt
      */
     findById : function(fragment, itemId) {
 
+        if (fragment.nodeType == 1 && fragment.querySelector) {
+            //we can use the query selector here
+            if (fragment.id && fragment.id === itemId) return fragment;
+            return fragment.querySelector("#" + itemId);
+        }
+
         var filter = function(node) {
             return 'undefined' != typeof node.id && node.id === itemId;
         };
-
         return this.findFirst(fragment, filter);
     },
 
@@ -215,20 +217,22 @@ myfaces._impl.core._Runtime.singletonExt
     findFirst : function(fragment, filter) {
         myfaces._impl._util._Lang._assertType(filter, "function");
 
-        /*if (document.createTreeWalker && NodeFilter) {
-            //we have a tree walker in place this allows for an optimized deep scan
-            var lastElementFound = null;
-            var treeWalkerfilter = function (node) {
-                return ((filter(node)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP);
-            };
-
-            var treeWalker = document.createTreeWalker(fragment, NodeFilter.SHOW_ELEMENT, treeWalkerfilter, false);
-            if (treeWalker.nextNode()) {
-                return treeWalker.currentNode;
-            }
-            return null;
-        }*/
+        if (document.createTreeWalker && NodeFilter) {
+            return this._iteratorBasedFindFirst(fragment, filter);
+        } else {
+            return this._recursionBasedFindFirst(fragment, filter);
+        }
+    },
 
+    /**
+     * a simple recusion based find first which iterates over the
+     * dom tree the classical way which is also the slowest one
+     * but that one will work back to ie6+
+     *
+     * @param fragment the starting fragment
+     * @param filter the filter to be applied to
+     */
+    _recursionBasedFindFirst: function(fragment, filter) {
         if (filter(fragment)) {
             return fragment;
         }
@@ -242,7 +246,7 @@ myfaces._impl.core._Runtime.singletonExt
         var childLen = fragment.childNodes.length;
         for (cnt = 0; cnt < childLen; cnt++) {
             child = fragment.childNodes[cnt];
-            var item = this.findFirst(child, filter);
+            var item = this._recursionBasedFindFirst(child, filter);
             if (item != null)
                 return item;
         }
@@ -250,6 +254,29 @@ myfaces._impl.core._Runtime.singletonExt
     },
 
     /**
+     * the faster based iterator findFirst which will work
+     * on all html5 compliant browsers and a bunch of older ones
+     *
+     * @param fragment the fragment to be started from
+     * @param filter the filter which has to be used
+     */
+    _iteratorBasedFindFirst:function(fragment, filter) {
+        if (filter(fragment)) {
+            return fragment;
+        }
+        //we have a tree walker in place this allows for an optimized deep scan
+        var lastElementFound = null;
+        var treeWalkerfilter = function (node) {
+            return ((filter(node)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP);
+        };
+        var treeWalker = document.createTreeWalker(fragment, NodeFilter.SHOW_ELEMENT, treeWalkerfilter, false);
+        if (treeWalker.nextNode()) {
+            return treeWalker.currentNode;
+        }
+        return null;
+    },
+
+    /**
      * determines the number of nodes according to their tagType
      *
      * @param {Node} fragment (Node or fragment) the fragment to be investigated
@@ -265,14 +292,26 @@ myfaces._impl.core._Runtime.singletonExt
      */
     findByTagName : function(fragment, tagName, deepScan) {
         var _Lang = myfaces._impl._util._Lang;
-        var filter = function(node) {
-            return _Lang.exists(node, "tagName") && _Lang.equalsIgnoreCase(node.tagName, tagName);
-        };
 
         if ('undefined' == typeof deepScan) {
             deepScan = false;
         }
 
+        var filter = function(node) {
+            return _Lang.exists(node, "tagName") && _Lang.equalsIgnoreCase(node.tagName, tagName);
+        };
+
+        //html 5 selector
+        if (deepScan && fragment.querySelectorAll) {
+            var result = fragment.querySelectorAll(tagName);
+            if (fragment.nodeType == 1 && filter(fragment)) {
+                result = (result == null) ? [] : _Lang.objToArray(result);
+                result.push(fragment);
+                return result;
+            }
+        }
+        //if we are not in a html 5 environment which supports node selectors
+        //we use the usual recursive fallback.
         return this.findAll(fragment, filter, deepScan);
 
     },
@@ -286,6 +325,15 @@ myfaces._impl.core._Runtime.singletonExt
             deepScan = false;
         }
 
+        if (deepScan && fragment.querySelectorAll) {
+            var result = fragment.querySelectorAll("[name=" + name + "]");
+            if (fragment.nodeType == 1 && filter(fragment)) {
+                result = (result == null) ? [] : _Lang.objToArray(result);
+                result.push(fragment);
+                return result;
+            }
+        }
+
         return this.findAll(fragment, filter, deepScan);
     },
 
@@ -314,6 +362,22 @@ myfaces._impl.core._Runtime.singletonExt
             deepScan = false;
         }
 
+        //html5 speed optimization, but only for deep scan and normal parent nodes
+        if (fragment.querySelectorAll && deepScan) {
+            var selector = "." + styleClass;
+            var result = fragment.querySelectorAll(selector);
+
+            if (fragment.nodeType == 1 && filter(fragment)) {
+                result = (result == null) ? [] : result;
+                result = _Lang.objToArrayl(result);
+                result.push(fragment);
+                return result;
+            }
+            return result;
+        }
+
+        //fallback to the classical filter methods if we cannot use the
+        //html 5 selectors for whatever reason
         return this.findAll(fragment, filter, deepScan);
     },
 
@@ -326,46 +390,28 @@ myfaces._impl.core._Runtime.singletonExt
      * @param deepScan if set to true or not set at all a deep scan is performed (for form scans it does not make much sense to deeply scan)
      */
     findAll : function(rootNode, filter, deepScan) {
-        var retVal = [];
         var _Lang = myfaces._impl._util._Lang;
-
         _Lang._assertType(filter, "function");
 
-        /*
-         one of my unit tests causing the treewalker to hang, have to fix that
-         before issuing that code
-         if (document.createTreeWalker && NodeFilter) {
-         //Works on firefox and webkit, opera and ie have to use the slower fallback mechanis
-         //we have a tree walker in place this allows for an optimized deep scan
-         var lastElementFound = null;
-         if (filter(rootNode)) {
-         lastElementFound = rootNode;
-         retVal.push(rootNode);
-         }
-
-         var treeWalkerfilter = function (node) {
-         _Lang.logInfo(node.className, "-", deepScan);
-         if (!deepScan && lastElementFound != null && node.parentNode == lastElementFound) {
-         return NodeFilter.FILTER_REJECT;
-         }
-
-         var retVal = (filter(node)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
-         if (retVal == NodeFilter.FILTER_ACCEPT) {
-         lastElementFound = node;
-         }
-         return retVal;
-         };
-
-         var treeWalker = document.createTreeWalker(rootNode, NodeFilter.SHOW_ELEMENT, treeWalkerfilter, false);
-         int cnt = 0;
-         while (treeWalker.nextNode()) {
-
-         retVal.push(treeWalker.currentNode);
-
-         }
-         return retVal;
-         } */
+        if (document.createTreeWalker && NodeFilter) {
+            return this._iteratorBasedSearchAll(rootNode, filter, deepScan);
+        } else {
+            return this._recursionBasedSearchAll(rootNode, filter, deepScan);
+        }
 
+    },
+
+    /**
+     * classical recursive way which definitely will work on all browsers
+     * including the IE6
+     *
+     * @param rootNode the root node
+     * @param filter the filter to be applied to
+     * @param deepScan if set to true a deep scan is performed
+     */
+    _recursionBasedSearchAll: function(rootNode, filter, deepScan) {
+        var _Lang = myfaces._impl._util._Lang;
+        var retVal = [];
         //fix the value to prevent undefined errors
         if ('undefined' == typeof deepScan) {
             deepScan = true;
@@ -386,13 +432,52 @@ myfaces._impl.core._Runtime.singletonExt
         var childLen = rootNode.childNodes.length;
         for (var cnt = 0; (deepScan || retValLen == 0) && cnt < childLen; cnt++) {
             var childNode = rootNode.childNodes[cnt];
-            var subRetVals = this.findAll(childNode, filter, deepScan);
+            var subRetVals = this._recursionBasedSearchAll(childNode, filter, deepScan);
             retVal = retVal.concat(subRetVals);
         }
         return retVal;
     },
 
     /**
+     * the faster dom iterator based search, works on all newer browsers
+     * except ie8 which already have implemented the dom iterator functions
+     * of html 5 (which is pretty all standard compliant browsers)
+     *
+     * The advantage of this method is a faster tree iteration compared
+     * to the normal recursive tree walking.
+     *
+     * @param rootNode the root node to be iterated over
+     * @param filter the iteration filter
+     * @param deepScan if set to true a deep scan is performed
+     */
+    _iteratorBasedSearchAll: function(rootNode, filter, deepScan) {
+        var retVal = [];
+        //Works on firefox and webkit, opera and ie have to use the slower fallback mechanis
+        //we have a tree walker in place this allows for an optimized deep scan
+        var lastElementFound = null;
+        if (filter(rootNode)) {
+            lastElementFound = rootNode;
+            retVal.push(rootNode);
+            if (!deepScan) {
+                return retVal;
+            }
+        }
+        //we use the reject mechanism to prevent a deep scan reject means any
+        //child elements will be omitted from the scan
+        var treeWalkerfilter = function (node) {
+            var retCode = (filter(node)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
+            retCode = (!deepScan && retCode == NodeFilter.FILTER_ACCEPT) ? NodeFilter.FILTER_REJECT : retCode;
+            if (retCode == NodeFilter.FILTER_ACCEPT || retCode == NodeFilter.FILTER_REJECT) {
+                retVal.push(node);
+            }
+            return retCode;
+        };
+        var treeWalker = document.createTreeWalker(rootNode, NodeFilter.SHOW_ELEMENT, treeWalkerfilter, false);
+        while (treeWalker.nextNode());
+        return retVal;
+    },
+
+    /**
      *
      * @param {Node} form
      * @param {String} nameOrIdenitifier
@@ -410,7 +495,8 @@ myfaces._impl.core._Runtime.singletonExt
             if ('undefined' != typeof elem.id && elem.id === nameOrIdenitifier) return elem;
         } // end of for (formElements)
         return null;
-    },
+    }
+    ,
 
     /**
      * bugfixing for ie6 which does not cope properly with setAttribute
@@ -474,7 +560,7 @@ myfaces._impl.core._Runtime.singletonExt
             //check if the attribute is an event, since this applies only
             //to quirks mode of ie anyway we can live with the standard html4/xhtml
             //ie supported events
-            if (this._ieQuircksEvents[attribute]) {
+            if (this.IE_QUIRKS_EVENTS[attribute]) {
                 if (_Lang.isString(attribute)) {
                     domNode.setAttribute(attribute, function(event) {
                         //event implicitly used
@@ -486,7 +572,8 @@ myfaces._impl.core._Runtime.singletonExt
                 domNode.setAttribute(attribute, value);
             }
         }
-    },
+    }
+    ,
 
     /**
      * gets an element from a form with its id -> sometimes two elements have got
@@ -520,7 +607,6 @@ myfaces._impl.core._Runtime.singletonExt
 
             //we first check for a name entry!
 
-
             //'undefined' != typeof form.elements[itemIdOrName] && null != form.elements[itemIdOrName]
             if (nameSearch && _Lang.exists(form, "elements." + itemIdOrName)) {
                 return form.elements[itemIdOrName];
@@ -541,7 +627,8 @@ myfaces._impl.core._Runtime.singletonExt
             _Lang.throwNewError(request, context, "Utils", "getElementFromForm", e);
         }
         return null;
-    },
+    }
+    ,
 
     /**
      * fuzzy form detection which tries to determine the form
@@ -634,7 +721,8 @@ myfaces._impl.core._Runtime.singletonExt
         }
 
         return foundElements[0];
-    },
+    }
+    ,
 
     /**
      * [STATIC]
@@ -680,7 +768,8 @@ myfaces._impl.core._Runtime.singletonExt
         } else {
             return null;
         }
-    },
+    }
+    ,
 
 
     /**
@@ -702,11 +791,11 @@ myfaces._impl.core._Runtime.singletonExt
             }
         }
         return null;
-    },
+    }
+    ,
 
 
     /**
-     * [STATIC]
      * gets the child of an item with a given tag name
      * @param {Node} item - parent element
      * @param {String} childName - TagName of child element
@@ -723,7 +812,8 @@ myfaces._impl.core._Runtime.singletonExt
         }
 
         return this.getFilteredChild(item, filter);
-    },
+    }
+    ,
 
 
 
@@ -768,7 +858,8 @@ myfaces._impl.core._Runtime.singletonExt
             return node.getAttribute(ta.toLowerCase());	//	string
         }
         return null;	//	string
-    },
+    }
+    ,
 
     /**
      * checks whether the given node has an attribute attached
@@ -781,7 +872,8 @@ myfaces._impl.core._Runtime.singletonExt
         //	summary
         //	Determines whether or not the specified node carries a value for the attribute in question.
         return this.getAttribute(node, attr) ? true : false;	//	boolean
-    },
+    }
+    ,
 
     /**
      * fetches the style class for the node
@@ -803,16 +895,18 @@ myfaces._impl.core._Runtime.singletonExt
             }
         }
         return cs.replace(/^\s+|\s+$/g, "");
-    },
+    }
+    ,
     /**
-     * fdtches the class for the node,
+     * fetches the class for the node,
      * cross ported from the dojo toolkit
      * @param {String|Object}node the node to search
      */
     getClasses : function(node) {
         var c = this.getClass(node);
         return (c == "") ? [] : c.split(/\s+/g);
-    },
+    }
+    ,
 
     /**
      * concatenation routine which concats all childnodes of a node which
@@ -834,5 +928,6 @@ myfaces._impl.core._Runtime.singletonExt
     byId: function(identifier) {
         return myfaces._impl._util._Lang.byId(identifier);
     }
-});
+})
+        ;
     

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Lang.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Lang.js?rev=944652&r1=944651&r2=944652&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Lang.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Lang.js Sat May 15 14:43:00 2010
@@ -44,7 +44,7 @@ myfaces._impl.core._Runtime.singletonExt
      * cross port from the dojo lib
      * browser save event resolution
      * @param event the event object
-     * (with a fallback for ie events if none is present) 
+     * (with a fallback for ie events if none is present)
      */
     getEventTarget: function(event) {
         if (!event) {
@@ -437,23 +437,43 @@ myfaces._impl.core._Runtime.singletonExt
         }
     },
 
+    objToArray: function(obj) {
+
+        try {
+            return Array.prototype.slice.call(obj, 0);
+        } catch (e) {
+            //ie8 (again as only browser) delivers for css 3 selectors a non convertible object
+            //we have to do it the hard way
+            //ie8 seems generally a little bit strange in its behavior some
+            //objects break the function is everything methodology of javascript
+            //and do not implement apply call, or are pseudo arrays which cannot
+            //be sliced
+            var retVal = [];
+            for (var cnt = 0; cnt < obj.length; cnt++) {
+                retVal.push(obj[cnt]);
+            }
+            return retVal;
+        }
+
+    },
+
     logLog: function(/*varargs*/) {
-        var argumentStr = Array.prototype.slice.call(arguments, 0).join(" ");
+        var argumentStr = this.objToArray(arguments).join(" ");
         if (window.console && window.console.log) {
             window.console.log(argumentStr);
         }
         this._logToContainer("logLog", ["Log:"].concat([argumentStr]));
     },
     logDebug: function(/*varargs*/) {
-        var argumentStr = Array.prototype.slice.call(arguments, 0).join(" ");
+        var argumentStr = this.objToArray(arguments).join(" ");
 
-        if (window.console && window.console.log) {
+        if (window.console && window.console.debug) {
             window.console.debug(argumentStr);
         }
         this._logToContainer("logDebug", ["Debug:"].concat([argumentStr]));
     },
     logError: function(/*varargs*/) {
-        var argumentStr = Array.prototype.slice.call(arguments, 0).join(" ");
+        var argumentStr = this.objToArray(arguments).join(" ");
 
         if (window.console && window.console.error) {
             window.console.error(argumentStr);
@@ -462,7 +482,7 @@ myfaces._impl.core._Runtime.singletonExt
 
     },
     logInfo: function(/*varargs*/) {
-        var argumentStr = Array.prototype.slice.call(arguments, 0).join(" ");
+        var argumentStr = this.objToArray(arguments).join(" ");
 
         if (window.console && window.console.info) {
             window.console.info(argumentStr);
@@ -470,7 +490,7 @@ myfaces._impl.core._Runtime.singletonExt
         this._logToContainer("logInfo", ["Info:"].concat([argumentStr]));
     },
     logWarn: function(/*varargs*/) {
-        var argumentStr = Array.prototype.slice.call(arguments, 0).join(" ");
+        var argumentStr = this.objToArray(arguments).join(" ");
         if (window.console && window.console.warn) {
             window.console.warn(argumentStr);
         }

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_UnitTest.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_UnitTest.js?rev=944652&r1=944651&r2=944652&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_UnitTest.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_UnitTest.js Sat May 15 14:43:00 2010
@@ -1,5 +1,10 @@
 /**
  * This class is for http based unit tests
+ *
+ * note this class is only for testing pages
+ * and is not added to the final build
+ * we use it internally for testing pages
+ * which test the various functions of the framework
  */
 myfaces._impl.core._Runtime.singletonExtendClass("myfaces._impl._util._UnitTest", Object, {
 

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js?rev=944652&r1=944651&r2=944652&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js Sat May 15 14:43:00 2010
@@ -172,11 +172,11 @@ if ('undefined' == typeof  myfaces._impl
      * false otherwise for further action
      */
     myfaces._impl.core._Runtime.reserveNamespace = function(nameSpace, reservationFunction) {
-        var _Core = myfaces._impl.core._Runtime;
-        if (!_Core.isString(nameSpace)) {
+        var _RT = myfaces._impl.core._Runtime;
+        if (!_RT.isString(nameSpace)) {
             throw Error("Namespace must be a string with . as delimiter");
         }
-        if (null != _Core.fetchNamespace(nameSpace)) {
+        if (null != _RT.fetchNamespace(nameSpace)) {
             return false;
         }
         var namespaceEntries = nameSpace.split(/\./);
@@ -410,18 +410,18 @@ if ('undefined' == typeof  myfaces._impl
      */
     myfaces._impl.core._Runtime.singletonExtendClass = function(newClass, extendsClass, prototypeFunctions, namespaceFunctions) {
 
-        var _Runtime = myfaces._impl.core._Runtime;
-        if (!_Runtime.isString(newClass)) {
+        var _RT = myfaces._impl.core._Runtime;
+        if (!_RT.isString(newClass)) {
             throw Error("New class namespace must be of type string for static initialisation");
         }
         //namespace already declared we do not do anything further
-        if (_Runtime.fetchNamespace(newClass)) {
+        if (_RT.fetchNamespace(newClass)) {
             return null;
         }
 
         var initializer = myfaces._impl.core._Runtime.extendClass(newClass, extendsClass, prototypeFunctions, namespaceFunctions);
         if (initializer != null) {
-            _Runtime.applyToGlobalNamespace(newClass, new initializer());
+            _RT.applyToGlobalNamespace(newClass, new initializer());
         }
     };
 
@@ -459,7 +459,7 @@ if ('undefined' == typeof  myfaces._impl
      */
 
     myfaces._impl.core._Runtime.extendClass = function(newClass, extendsClass, prototypeFunctions) {
-        var _Runtime = myfaces._impl.core._Runtime;
+        var _RT = myfaces._impl.core._Runtime;
 
         if ('function' != typeof newClass) {
 
@@ -471,10 +471,10 @@ if ('undefined' == typeof  myfaces._impl
                 constructor = function() {
                 };
             }
-            if (!_Runtime.reserveNamespace(newClass, constructor)) {
+            if (!_RT.reserveNamespace(newClass, constructor)) {
                 return null;
             }
-            newClass = _Runtime.fetchNamespace(newClass);
+            newClass = _RT.fetchNamespace(newClass);
         }
 
         if (null != extendsClass) {
@@ -522,7 +522,7 @@ if ('undefined' == typeof  myfaces._impl
         }
         return newClass;
     };
-
+    
     /**
      * determines if the embedded scripts have to be evaled manually
      * @return true if a browser combination is given which has to