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 2011/10/14 15:08:16 UTC

svn commit: r1183343 - in /myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl: _util/_ExtDom.js _util/_Lang.js core/_EndImpl.js core/_ExtRuntime.js core/_Runtime.js

Author: werpu
Date: Fri Oct 14 13:08:15 2011
New Revision: 1183343

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



Added:
    myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_EndImpl.js
    myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_ExtRuntime.js
Modified:
    myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ExtDom.js
    myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Lang.js
    myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js

Modified: myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ExtDom.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ExtDom.js?rev=1183343&r1=1183342&r2=1183343&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ExtDom.js (original)
+++ myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ExtDom.js Fri Oct 14 13:08:15 2011
@@ -1,4 +1,21 @@
-_MF_SINGLTN("myfaces._impl._util._ExtDom", myfaces._impl._util._Dom, {
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+myfaces._impl.core._Runtime.singletonDelegateObj("myfaces._impl._util._ExtDom", myfaces._impl._util._Dom, {
 
     _Lang:myfaces._impl._util._Lang,
     _RT:myfaces._impl.core._Runtime,

Modified: myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Lang.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Lang.js?rev=1183343&r1=1183342&r2=1183343&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Lang.js (original)
+++ myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Lang.js Fri Oct 14 13:08:15 2011
@@ -46,7 +46,7 @@
  * decorates the namespace myfaces._impl.core._Runtime and adds a bunch of new methods to
  * what _Runtime provided
  * */
-var _Lang = myfaces._impl.core._Runtime.singletonDelegateObj("myfaces._impl._util._Lang", myfaces._impl.core._Runtime,
+var _Lang = _MF_SINGLTN("myfaces._impl._util._Lang", Object,
         /**
          * @lends myfaces._impl._util._Lang.prototype
          */
@@ -56,6 +56,8 @@ var _Lang = myfaces._impl.core._Runtime.
 
     _installedLocale: null,
 
+    _RT: myfaces._impl.core._Runtime,
+
     /**
      * returns a given localized message upon a given key
      * basic java log like templating functionality is included
@@ -96,7 +98,7 @@ var _Lang = myfaces._impl.core._Runtime.
             this._installedLocale = new newLocale();
             return;
         }
-        var language_Variant = this._callDelegate("getLanguage", this._callDelegate("getGlobalConfig","locale")); 
+        var language_Variant = this._RT.getLanguage(this._RT.getGlobalConfig("locale"));
         var langStr = language_Variant ? language_Variant.language:"";
         var variantStr = language_Variant ? [language_Variant.language,"_",language_Variant.variant||""].join(""):"";
 
@@ -108,6 +110,13 @@ var _Lang = myfaces._impl.core._Runtime.
         this._installedLocale = new i18nHolder();
     },
 
+    assertType: function(probe, theType) {
+       return this._RT.assertType(probe, theType);
+    },
+
+     exists: function(nms, theType) {
+       return this._RT.exists(nms, theType);
+    },
 
     isExceptionProcessed: function(e) {
         return !! this._processedExceptions[e.toString()];
@@ -129,21 +138,21 @@ var _Lang = myfaces._impl.core._Runtime.
         if (!namespace || !this.isString(namespace)) {
             throw Error(this.getMessage("ERR_MUST_STRING",null,"_Lang.fetchNamespace","namespace"));
         }
-        return this._callDelegate("fetchNamespace", namespace);
+        return this._RT.fetchNamespace(namespace);
     },
 
     reserveNamespace : function(namespace) {
         if (!this.isString(namespace)) {
             throw Error(this.getMessage("ERR_MUST_STRING",null,"_Lang.reserveNamespace", "namespace"));
         }
-        return this._callDelegate("reserveNamespace", namespace);
+        return this._RT.reserveNamespace(namespace);
     },
 
     globalEval : function(code) {
         if (!this.isString(code)) {
             throw Error(this.getMessage("ERR_MUST_STRING",null,"_Lang.globalEval", "code"));
         }
-        return this._callDelegate("globalEval", code);
+        return  this._RT.globalEval(code);
     },
 
 
@@ -329,69 +338,15 @@ var _Lang = myfaces._impl.core._Runtime.
      * (notably happens often in lazy xhr code)
      *
      * @param {Function} scope of the function to be executed in
-     * @param {Function} method to be executed
+     * @param {Function} method to be executed, the method must be of type function
      *
-     * @return whatevery the executed method returns
+     * @return whatever the executed method returns
      */
-    hitch : function(/*Object*/scope, /*Function|String*/method /*,...*/) {
-        //	summary:
-        //		Returns a function that will only ever execute in the a given scope.
-        //		This allows for easy use of object member functions
-        //		in callbacks and other places in which the "this" keyword may
-        //		otherwise not reference the expected scope.
-        //		Any number of default positional arguments may be passed as parameters
-        //		beyond "method".
-        //		Each of these values will be used to "placehold" (similar to curry)
-        //		for the hitched function.
-        //	scope:
-        //		The scope to use when method executes. If method is a string,
-        //		scope is also the object containing method.
-        //	method:
-        //		A function to be hitched to scope, or the name of the method in
-        //		scope to be hitched.
-        //	example:
-        //	|	myfaces._impl._util._Lang.hitch(foo, "bar")();
-        //		runs foo.bar() in the scope of foo
-        //	example:
-        //	|	myfaces._impl._util._Lang.hitch(foo, myFunction);
-        //		returns a function that runs myFunction in the scope of foo
-        if (arguments.length > 2) {
-            return this._hitchArgs._hitchArgs.apply(this._hitchArgs, arguments); // Function
-        }
-        if (!method) {
-            method = scope;
-            scope = null;
-        }
-        if (this.isString(method)) {
-            scope = scope || window || function() {
-            };
-            /*since we do not have dojo global*/
-            if (!scope[method]) {
-                throw(['myfaces._impl._util._Lang: scope["', method, '"] is null (scope="', scope, '")'].join(''));
-            }
-            return function() {
-                return scope[method].apply(scope, arguments || []);
-            }; // Function
-        }
+    hitch : function(scope, method) {
         return !scope ? method : function() {
             return method.apply(scope, arguments || []);
         }; // Function
-    }
-    ,
-
-    _hitchArgs : function(scope, method /*,...*/) {
-        var pre = this.objToArray(arguments, 2);
-        var named = this.isString(method);
-        return function() {
-            // array-fy arguments
-            var args = this.objToArray(arguments);
-            // locate our method
-            var f = named ? (scope || this.global)[method] : method;
-            // invoke with collected args
-            return f && f.apply(scope || this, pre.concat(args)); // mixed
-        }; // Function
-    }
-    ,
+    },
 
     /**
      * Helper function to merge two maps
@@ -443,8 +398,7 @@ var _Lang = myfaces._impl.core._Runtime.
             }
         }
         return false;
-    }
-    ,
+    },
 
 
     arrToMap: function(arr, offset) {

Added: myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_EndImpl.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_EndImpl.js?rev=1183343&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_EndImpl.js (added)
+++ myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_EndImpl.js Fri Oct 14 13:08:15 2011
@@ -0,0 +1,12 @@
+/*last file loaded, must restore the state of affairs*/
+(function() {
+    var _RT = myfaces._impl.core._Runtime;
+	if(_RT._oldExtends) {
+	    window._MF_CLS = _RT._oldExtends;
+	}
+	if(_RT._oldSingleton) {
+	   window._MF_SINGLTN = _RT._oldSingleton;
+	}
+})();
+
+

Added: myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_ExtRuntime.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_ExtRuntime.js?rev=1183343&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_ExtRuntime.js (added)
+++ myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_ExtRuntime.js Fri Oct 14 13:08:15 2011
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Runtime Extension which externalizes code not used in the core but in the extension classes
+ */
+
+/**
+ * A dojo like require to load scripts dynamically, note
+ * to use this mechanism you have to set your global config param
+ * myfacesScriptRoot to the root of your script files (aka under normal circumstances
+ * resources/scripts)
+ *
+ * @param {String} nms the subnamespace to be required
+ */
+(function() {
+
+    var _T = myfaces._impl.core._Runtime;
+
+    _T.require = function(nms) {
+        //namespace exists
+        if (_T.exists(nms)) return;
+        var rootPath = _T.getGlobalConfig("myfacesScriptRoot", "");
+        this.loadScriptEval(rootPath + "/" + nms.replace(/\./g, "/") + ".js");
+    };
+
+    /**
+     * delegation pattern
+     * usage:
+     * this.delegateObject("my.name.space", delegate,
+     * {
+     *  constructor_ :function(bla, bla1) {
+     *      _T._callDelegate("constructor", bla1);
+     *  },
+     *  myFunc: function(yyy) {
+     *      DoSomething;
+     *      _T._callDelegate("someOtherFunc", yyyy);
+     *  }, null
+     * });
+     *
+     * or
+     * usage var newClass = this.delegateObject(
+     * function (var1, var2) {
+     *  _T._callDelegate("constructor", var1,var2);
+     * };
+     * ,delegateObject);
+     * newClass.prototype.myMethod = function(arg1) {
+     *      _T._callDelegate("myMethod", arg1,"hello world");
+     *
+     *
+     * @param {String} newCls the new class name to be generated
+     * @param {Object} delegateObj the delegation object
+     * @param {Object} protoFuncs the prototype functions which should be attached
+     * @param {Object} nmsFuncs the namespace functions which should be attached to the namespace
+     */
+    _T.delegateObj = function(newCls, delegateObj, protoFuncs, nmsFuncs) {
+        if (!_T.isString(newCls)) {
+            throw Error("new class namespace must be of type String");
+        }
+
+        if ('function' != typeof newCls) {
+            newCls = _reserveClsNms(newCls, protoFuncs);
+            if (!newCls) return null;
+        }
+
+        //central delegation mapping core
+        var proto = newCls.prototype;
+
+        //the trick here is to isolate the entries to bind the
+        //keys in a private scope see
+        //http://www.ruzee.com/blog/2008/12/javascript-inheritance-via-prototypes-and-closures
+        for (var key in delegateObj) (function(key, delFn) {
+            //The isolation is needed otherwise the last _key assigend would be picked
+            //up internally
+            if (key && typeof delFn == "function") {
+                proto[key] = function(/*arguments*/) {
+                    return delFn.apply(delegateObj, arguments);
+                };
+            }
+        })(key, delegateObj[key]);
+
+        proto._delegateObj = delegateObj;
+        proto.constructor = newCls;
+
+        proto._callDelegate = function(methodName) {
+            var passThrough = (arguments.length == 1) ? [] : Array.prototype.slice.call(arguments, 1);
+            var ret = this._delegateObj[methodName].apply(this._delegateObj, passThrough);
+            if ('undefined' != ret) return ret;
+        };
+
+        //we now map the function map in
+        _T._applyFuncs(newCls, protoFuncs, true);
+        _T._applyFuncs(newCls, nmsFuncs, false);
+
+        return newCls;
+    };
+
+    /**
+     * convenience method which basically replaces an existing class
+     * with a new one under the same namespace, note all old functionality will be
+     * presereced by pushing the original class into an new nampespace
+     *
+     * @param classNms the namespace for the class, must already be existing
+     * @param protoFuncs the new prototype functions which are plugins for the old ones
+     * @param overWrite if set to true replaces the old funcs entirely otherwise just does an implicit
+     * inheritance with super being remapped
+     *
+     * TODO do not use this function yet it needs some refinement, it will be interesting later
+     * anyway, does not work yet
+     */
+    _T.pluginClass = function(classNms, protoFuncs, overWrite) {
+        var oldClass = _T.fetchNamespace(classNms);
+        if (!oldClass) throw new Error("The class namespace " + classNms + " is not existent");
+
+        if (!overWrite) {
+            var preserveNMS = classNms + "." + ("" + _T._classReplacementCnt++);
+            _T.reserveNamespace(preserveNMS, oldClass);
+
+            return _T.extendClass(classNms, preserveNMS, protoFuncs);
+        } else {
+            if (protoFuncs.constructor_) {
+                newCls.prototype.constructor = protoFuncs.constructor_;
+            }
+            _T._applyFuncs(oldClass, protoFuncs, true);
+        }
+    };
+
+
+
+    /**
+     * delegation pattern which attached singleton generation
+     *
+     * @param newCls the new namespace object to be generated as singletoin
+     * @param delegateObj the object which has to be delegated
+     * @param protoFuncs the prototype functions which are attached on prototype level
+     * @param nmsFuncs the functions which are attached on the classes namespace level
+     */
+    _T.singletonDelegateObj = function(newCls, delegateObj, protoFuncs, nmsFuncs) {
+        if (_T._reservedNMS[newCls]) {
+            return;
+        }
+        return _T._makeSingleton(_T.delegateObj, newCls, delegateObj, protoFuncs, nmsFuncs);
+    };
+
+})();
\ No newline at end of file

Modified: myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js?rev=1183343&r1=1183342&r2=1183343&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js (original)
+++ myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js Fri Oct 14 13:08:15 2011
@@ -265,20 +265,7 @@ if (!myfaces._impl.core._Runtime) {
             }
         };
 
-        /**
-         * A dojo like require to load scripts dynamically, note
-         * to use this mechanism you have to set your global config param
-         * myfacesScriptRoot to the root of your script files (aka under normal circumstances
-         * resources/scripts)
-         *
-         * @param {String} nms the subnamespace to be required
-         */
-        this.require = function(nms) {
-            //namespace exists
-            if (_T.exists(nms)) return;
-            var rootPath = _T.getGlobalConfig("myfacesScriptRoot", "");
-            _T.loadScriptEval(rootPath + "/" + nms.replace(/\./g, "/") + ".js");
-        };
+
 
         /**
          * fetches a global config entry
@@ -482,76 +469,7 @@ if (!myfaces._impl.core._Runtime) {
 
         //Base Patterns, Inheritance, Delegation and Singleton
 
-        /**
-         * delegation pattern
-         * usage:
-         * this.delegateObject("my.name.space", delegate,
-         * {
-         *  constructor_ :function(bla, bla1) {
-         *      _T._callDelegate("constructor", bla1);
-         *  },
-         *  myFunc: function(yyy) {
-         *      DoSomething;
-         *      _T._callDelegate("someOtherFunc", yyyy);
-         *  }, null
-         * });
-         *
-         * or
-         * usage var newClass = this.delegateObject(
-         * function (var1, var2) {
-         *  _T._callDelegate("constructor", var1,var2);
-         * };
-         * ,delegateObject);
-         * newClass.prototype.myMethod = function(arg1) {
-         *      _T._callDelegate("myMethod", arg1,"hello world");
-         *
-         *
-         * @param {String} newCls the new class name to be generated
-         * @param {Object} delegateObj the delegation object
-         * @param {Object} protoFuncs the prototype functions which should be attached
-         * @param {Object} nmsFuncs the namespace functions which should be attached to the namespace
-         */
-        this.delegateObj = function(newCls, delegateObj, protoFuncs, nmsFuncs) {
-            if (!_T.isString(newCls)) {
-                throw Error("new class namespace must be of type String");
-            }
-
-            if ('function' != typeof newCls) {
-                newCls = _reserveClsNms(newCls, protoFuncs);
-                if (!newCls) return null;
-            }
-
-            //central delegation mapping core
-            var proto = newCls.prototype;
-
-            //the trick here is to isolate the entries to bind the
-            //keys in a private scope see
-            //http://www.ruzee.com/blog/2008/12/javascript-inheritance-via-prototypes-and-closures
-            for (var key in delegateObj) (function(key, delFn) {
-                //The isolation is needed otherwise the last _key assigend would be picked
-                //up internally
-                if (key && typeof delFn == "function") {
-                    proto[key] = function(/*arguments*/) {
-                        return delFn.apply(delegateObj, arguments);
-                    };
-                }
-            })(key, delegateObj[key]);
-
-            proto._delegateObj = delegateObj;
-            proto.constructor = newCls;
 
-            proto._callDelegate = function(methodName) {
-                var passThrough = (arguments.length == 1) ? [] : Array.prototype.slice.call(arguments, 1);
-                var ret = this._delegateObj[methodName].apply(this._delegateObj, passThrough);
-                if ('undefined' != ret) return ret;
-            };
-
-            //we now map the function map in
-            _applyFuncs(newCls, protoFuncs, true);
-            _applyFuncs(newCls, nmsFuncs, false);
-
-            return newCls;
-        };
 
         /*
          * prototype based delegation inheritance
@@ -665,44 +583,16 @@ if (!myfaces._impl.core._Runtime) {
             }
 
             //we now map the function map in
-            _applyFuncs(newCls, protoFuncs, true);
+            _T._applyFuncs(newCls, protoFuncs, true);
             //we could add inherited but that would make debugging harder
             //see http://www.ruzee.com/blog/2008/12/javascript-inheritance-via-prototypes-and-closures on how to do it
 
-            _applyFuncs(newCls, nmsFuncs, false);
+            _T._applyFuncs(newCls, nmsFuncs, false);
 
             return newCls;
         };
 
-        /**
-         * convenience method which basically replaces an existing class
-         * with a new one under the same namespace, note all old functionality will be
-         * presereced by pushing the original class into an new nampespace
-         *
-         * @param classNms the namespace for the class, must already be existing
-         * @param protoFuncs the new prototype functions which are plugins for the old ones
-         * @param overWrite if set to true replaces the old funcs entirely otherwise just does an implicit
-         * inheritance with super being remapped
-         *
-         * TODO do not use this function yet it needs some refinement, it will be interesting later
-         * anyway
-         */
-        this.pluginClass = function(classNms, protoFuncs, overWrite) {
-            var oldClass = _T.fetchNamespace(classNms);
-            if (!oldClass) throw new Error("The class namespace " + classNms + " is not existent");
-
-            if (!overWrite) {
-                var preserveNMS = classNms + "." + ("" + _T._classReplacementCnt++);
-                _T.reserveNamespace(preserveNMS, oldClass);
 
-                return _T.extendClass(classNms, preserveNMS, protoFuncs);
-            } else {
-                if (protoFuncs.constructor_) {
-                    newCls.prototype.constructor = protoFuncs.constructor_;
-                }
-                _applyFuncs(oldClass, protoFuncs, true);
-            }
-        };
 
         /**
          * Extends a class and puts a singleton instance at the reserved namespace instead
@@ -713,38 +603,25 @@ if (!myfaces._impl.core._Runtime) {
          * @param {Object} protoFuncs (Map) an optional map of prototype functions which in case of overwriting a base function get an inherited method
          */
         this.singletonExtendClass = function(newCls, extendsCls, protoFuncs, nmsFuncs) {
-            return _makeSingleton(_T.extendClass, newCls, extendsCls, protoFuncs, nmsFuncs);
+            return _T._makeSingleton(_T.extendClass, newCls, extendsCls, protoFuncs, nmsFuncs);
         };
 
-        /**
-         * delegation pattern which attached singleton generation
-         *
-         * @param newCls the new namespace object to be generated as singletoin
-         * @param delegateObj the object which has to be delegated
-         * @param protoFuncs the prototype functions which are attached on prototype level
-         * @param nmsFuncs the functions which are attached on the classes namespace level
-         */
-        this.singletonDelegateObj = function(newCls, delegateObj, protoFuncs, nmsFuncs) {
-            if (_T._reservedNMS[newCls]) {
-                return;
-            }
-            return _makeSingleton(_T.delegateObj, newCls, delegateObj, protoFuncs, nmsFuncs);
-        };
+
 
         //since the object is self contained and only
         //can be delegated we can work with real private
         //functions here, the other parts of the
         //system have to emulate them via _ prefixes
-        var _makeSingleton = function(ooFunc, newCls, delegateObj, protoFuncs, nmsFuncs) {
+        this._makeSingleton = function(ooFunc, newCls, delegateObj, protoFuncs, nmsFuncs) {
             if (_T._reservedNMS[newCls]) {
-                return;
+                return _T._reservedNMS[newCls];
             }
 
             var clazz = ooFunc(newCls + "._mfClazz", delegateObj, protoFuncs, nmsFuncs);
             if (clazz != null) {
                 _T.applyToGlobalNamespace(newCls, new clazz());
             }
-            _T.fetchNamespace(newCls)["_mfClazz"] = clazz;
+            return _T.fetchNamespace(newCls)["_mfClazz"] = clazz;
         };
 
         //internal class namespace reservation depending on the type (string or function)
@@ -766,7 +643,7 @@ if (!myfaces._impl.core._Runtime) {
             return newCls;
         };
 
-        var _applyFuncs = function (newCls, funcs, proto) {
+        this._applyFuncs = function (newCls, funcs, proto) {
             if (funcs) {
                 for (var key in funcs) {
                     //constructor already passed, callSuper already assigned
@@ -835,6 +712,9 @@ if (!myfaces._impl.core._Runtime) {
             }
         };
 
+        //implemented in extruntime
+        this.singletonDelegateObj = function()  {};
+
         //initial browser detection, we encapsule it in a closure
         //to drop all temporary variables from ram as soon as possible
         (function() {
@@ -915,8 +795,11 @@ if (!myfaces._impl.core._Runtime) {
 }
 
 /*we cannot privatize with a global function hence we store the values away for the init part*/
-myfaces._impl.core._Runtime._oldExtends = window._MF_CLS;
-myfaces._impl.core._Runtime._oldSingleton = window._MF_SINGLETON;
-
-window._MF_CLS = myfaces._impl.core._Runtime.extendClass;
-window._MF_SINGLTN = myfaces._impl.core._Runtime.singletonExtendClass;
+(function() {
+    var _RT = myfaces._impl.core._Runtime;
+    _RT._oldExtends = window._MF_CLS;
+    _RT._oldSingleton = window._MF_SINGLTN;
+
+    window._MF_CLS = _RT.extendClass;
+    window._MF_SINGLTN = _RT.singletonExtendClass;
+})();