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/21 12:51:21 UTC

svn commit: r946969 [1/3] - in /myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces: _impl/_util/ _impl/core/ _impl/xhrCore/ api/

Author: werpu
Date: Fri May 21 10:51:20 2010
New Revision: 946969

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



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/_HtmlStripper.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/_ListenerQueue.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Queue.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/Impl.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequestQueue.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.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=946969&r1=946968&r2=946969&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 May 21 10:51:20 2010
@@ -29,6 +29,13 @@
  * TODO selector shortcuts bei chrome abdrehen da knallt es
  *
  */
+/** @namespace myfaces._impl._util._Dom */
+
+/** @namespace NodeFilter */
+/** @namespace NodeFilter.FILTER_ACCEPT */
+/** @namespace NodeFilter.FILTER_SKIP */
+/** @namespace NodeFilter.FILTER_REJECT */
+/** @namespace NodeFilter.SHOW_ELEMENT */
 myfaces._impl.core._Runtime.singletonExtendClass("myfaces._impl._util._Dom", Object, {
     IE_QUIRKS_EVENTS : {
         "onabort": true,
@@ -59,8 +66,8 @@ myfaces._impl.core._Runtime.singletonExt
      */
     runScripts: function(item) {
 
-        var executeScriptTag = myfaces._impl._util._Lang.hitch(this, function(item) {
-            if ('undefined' != typeof item.tagName && item.tagName.toLowerCase() == 'script') {
+        var execScrpt = myfaces._impl._util._Lang.hitch(this, function(item) {
+            if (item.tagName && item.tagName.toLowerCase() == 'script') {
 
                 if (typeof item.getAttribute('src') != 'undefined'
                         && item.getAttribute('src') != null
@@ -97,7 +104,7 @@ myfaces._impl.core._Runtime.singletonExt
             var scriptElements = this.findByTagName(item, "script", true);
             if (scriptElements == null) return;
             for (var cnt = 0; cnt < scriptElements.length; cnt++) {
-                executeScriptTag(scriptElements[cnt]);
+                execScrpt(scriptElements[cnt]);
             }
         } finally {
             //the usual ie6 fix code
@@ -105,7 +112,7 @@ myfaces._impl.core._Runtime.singletonExt
             //nulling closures helps somewhat to reduce
             //mem leaks, which are impossible to avoid
             //at this browser
-            executeScriptTag = null;
+            execScrpt = null;
         }
     },
 
@@ -114,7 +121,7 @@ myfaces._impl.core._Runtime.singletonExt
      */
     deleteItem: function(itemIdToReplace) {
         var item = this.byId(itemIdToReplace);
-        if (item == null) {
+        if (!item) {
             throw Error("_Dom.deleteItem  Unknown Html-Component-ID: " + itemIdToReplace);
         }
 
@@ -129,20 +136,19 @@ myfaces._impl.core._Runtime.singletonExt
      * @param markup the markup for the replacement
      */
     outerHTML : function(item, markup) {
-        markup = myfaces._impl._util._Lang.trim(markup);
-        if ('undefined' == typeof item || null == item) {
+        if (!item) {
             throw Error("myfaces._impl._util._Dom.outerHTML: item must be passed down");
         }
-        if ('undefined' == typeof markup || null == markup) {
+        if (!markup) {
             throw Error("myfaces._impl._util._Dom.outerHTML: markup must be passed down");
         }
-
-        if (markup != "") {
+        markup = myfaces._impl._util._Lang.trim(markup);
+        if (markup !== "") {
             var evalNode = null;
 
             //w3c compliant browsers with proper contextual fragments
             var parentNode;
-            if (typeof window.Range != 'undefined'
+            if (window.Range
                     && typeof Range.prototype.createContextualFragment == 'function') {
                 var range = document.createRange();
                 range.setStartBefore(item);
@@ -203,8 +209,8 @@ myfaces._impl.core._Runtime.singletonExt
      */
     findById : function(fragment, itemId) {
 
-        if(fragment === document) {
-            return document.getElementById(itemId);
+        if (fragment === document) {
+            return this.byId(itemId);
         }
 
         if (fragment.nodeType == 1 && fragment.querySelector) {
@@ -214,7 +220,7 @@ myfaces._impl.core._Runtime.singletonExt
         }
 
         var filter = function(node) {
-            return 'undefined' != typeof node.id && node.id === itemId;
+            return node && node.id && node.id === itemId;
         };
         try {
             return this.findFirst(fragment, filter);
@@ -232,12 +238,12 @@ myfaces._impl.core._Runtime.singletonExt
      * @param filter a filter closure which either returns true or false depending on triggering or not
      */
     findFirst : function(fragment, filter) {
-        myfaces._impl._util._Lang._assertType(filter, "function");
+        myfaces._impl._util._Lang.assertType(filter, "function");
 
         if (document.createTreeWalker && NodeFilter) {
-            return this._iteratorBasedFindFirst(fragment, filter);
+            return this._iteratorFindFirst(fragment, filter);
         } else {
-            return this._recursionBasedFindFirst(fragment, filter);
+            return this._recursionFindFirst(fragment, filter);
         }
     },
 
@@ -249,13 +255,14 @@ myfaces._impl.core._Runtime.singletonExt
      * @param fragment the starting fragment
      * @param filter the filter to be applied to
      */
-    _recursionBasedFindFirst: function(fragment, filter) {
+    _recursionFindFirst: function(fragment, filter) {
         if (filter(fragment)) {
             return fragment;
         }
 
-        if (fragment.childNodes == null)
+        if (!fragment.childNodes) {
             return null;
+        }
 
         //sub-fragment usecases
         var child;
@@ -263,7 +270,7 @@ myfaces._impl.core._Runtime.singletonExt
         var childLen = fragment.childNodes.length;
         for (cnt = 0; cnt < childLen; cnt++) {
             child = fragment.childNodes[cnt];
-            var item = this._recursionBasedFindFirst(child, filter);
+            var item = this._recursionFindFirst(child, filter);
             if (item != null)
                 return item;
         }
@@ -277,17 +284,18 @@ myfaces._impl.core._Runtime.singletonExt
      * @param fragment the fragment to be started from
      * @param filter the filter which has to be used
      */
-    _iteratorBasedFindFirst:function(fragment, filter) {
+    _iteratorFindFirst: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 walkerFilter = function (node) {
+            return (filter(node)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
         };
-        var treeWalker = document.createTreeWalker(fragment, NodeFilter.SHOW_ELEMENT, treeWalkerfilter, false);
+        var treeWalker = document.createTreeWalker(fragment, NodeFilter.SHOW_ELEMENT, walkerFilter, false);
         if (treeWalker.nextNode()) {
+            /** @namespace treeWalker.currentNode */
             return treeWalker.currentNode;
         }
         return null;
@@ -310,12 +318,10 @@ myfaces._impl.core._Runtime.singletonExt
     findByTagName : function(fragment, tagName, deepScan) {
         var _Lang = myfaces._impl._util._Lang;
 
-        if ('undefined' == typeof deepScan) {
-            deepScan = false;
-        }
+        deepScan = !!deepScan;
 
         var filter = function(node) {
-            return _Lang.exists(node, "tagName") && _Lang.equalsIgnoreCase(node.tagName, tagName);
+            return node.tagName && _Lang.equalsIgnoreCase(node.tagName, tagName);
         };
         try {
 
@@ -342,12 +348,10 @@ myfaces._impl.core._Runtime.singletonExt
     findByName : function(fragment, name, deepScan) {
         var _Lang = myfaces._impl._util._Lang;
         var filter = function(node) {
-            return  _Lang.exists(node, "name") && _Lang.equalsIgnoreCase(node.name, name);
+            return  node.name && _Lang.equalsIgnoreCase(node.name, name);
         };
         try {
-            if ('undefined' == typeof deepScan) {
-                deepScan = false;
-            }
+            deepScan = !!deepScan;
 
             if (deepScan && fragment.querySelectorAll) {
                 var result = fragment.querySelectorAll("[name=" + name + "]");
@@ -388,9 +392,7 @@ myfaces._impl.core._Runtime.singletonExt
             return false;
         });
         try {
-            if ('undefined' == typeof deepScan) {
-                deepScan = false;
-            }
+            deepScan = !!deepScan;
 
             //html5 getElementsByClassname
             if (fragment.getElementsByClassName && deepScan) {
@@ -405,7 +407,7 @@ myfaces._impl.core._Runtime.singletonExt
 
                 if (fragment.nodeType == 1 && filter(fragment)) {
                     result = (result == null) ? [] : result;
-                    result = _Lang.objToArrayl(result);
+                    result = _Lang.objToArray(result);
                     result.push(fragment);
                 }
                 return result;
@@ -433,12 +435,13 @@ myfaces._impl.core._Runtime.singletonExt
      */
     findAll : function(rootNode, filter, deepScan) {
         var _Lang = myfaces._impl._util._Lang;
-        _Lang._assertType(filter, "function");
+        _Lang.assertType(filter, "function");
+        deepScan = !!deepScan;
 
         if (document.createTreeWalker && NodeFilter) {
-            return this._iteratorBasedSearchAll(rootNode, filter, deepScan);
+            return this._iteratorSearchAll(rootNode, filter, deepScan);
         } else {
-            return this._recursionBasedSearchAll(rootNode, filter, deepScan);
+            return this._recursionSearchAll(rootNode, filter, deepScan);
         }
 
     }
@@ -452,33 +455,28 @@ myfaces._impl.core._Runtime.singletonExt
      * @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 = [];
+    _recursionSearchAll: function(rootNode, filter, deepScan) {
+        var ret = [];
         //fix the value to prevent undefined errors
-        if ('undefined' == typeof deepScan) {
-            deepScan = true;
-        }
 
         if (filter(rootNode)) {
-            retVal.push(rootNode);
-            if (!deepScan) return retVal;
+            ret.push(rootNode);
+            if (!deepScan) return ret;
         }
 
         //
-        if (!_Lang.exists(rootNode, "childNodes"))
-            return retVal;
+        if (!rootNode.childNodes) {
+            return ret;
+        }
 
         //subfragment usecases
 
-        var retValLen = retVal.length;
+        var retLen = ret.length;
         var childLen = rootNode.childNodes.length;
-        for (var cnt = 0; (deepScan || retValLen == 0) && cnt < childLen; cnt++) {
-            var childNode = rootNode.childNodes[cnt];
-            var subRetVals = this._recursionBasedSearchAll(childNode, filter, deepScan);
-            retVal = retVal.concat(subRetVals);
+        for (var cnt = 0; (deepScan || retLen == 0) && cnt < childLen; cnt++) {
+            ret = ret.concat(this._recursionSearchAll(rootNode.childNodes[cnt], filter, deepScan));
         }
-        return retVal;
+        return ret;
     }
     ,
 
@@ -494,13 +492,12 @@ myfaces._impl.core._Runtime.singletonExt
      * @param filter the iteration filter
      * @param deepScan if set to true a deep scan is performed
      */
-    _iteratorBasedSearchAll: function(rootNode, filter, deepScan) {
+    _iteratorSearchAll: 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;
@@ -508,7 +505,7 @@ myfaces._impl.core._Runtime.singletonExt
         }
         //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 walkerFilter = 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) {
@@ -516,7 +513,8 @@ myfaces._impl.core._Runtime.singletonExt
             }
             return retCode;
         };
-        var treeWalker = document.createTreeWalker(rootNode, NodeFilter.SHOW_ELEMENT, treeWalkerfilter, false);
+        var treeWalker = document.createTreeWalker(rootNode, NodeFilter.SHOW_ELEMENT, walkerFilter, false);
+        //noinspection StatementWithEmptyBodyJS
         while (treeWalker.nextNode());
         return retVal;
     }
@@ -525,20 +523,26 @@ myfaces._impl.core._Runtime.singletonExt
     /**
      *
      * @param {Node} form
-     * @param {String} nameOrIdenitifier
+     * @param {String} nameId
      *
      * checks for a a element with the name or identifier of nameOrIdentifier
      * @returns the found node or null otherwise
      */
-    findFormElement : function(form, nameOrIdenitifier) {
+    findFormElement : function(form, nameId) {
+        if (!form) {
+            throw Error("_Dom.findFormElement a form node must be given");
+        }
+        if (!nameId) {
+            throw Error("_Dom.findFormElement an element or identifier must be given");
+        }
+
         var eLen = form.elements.length;
-        //TODO add iterator handlers here for browsers which allow dom filters and iterators
-        var _RT = myfaces._impl.core._Runtime;
+
 
         for (var e = 0; e < eLen; e++) {
             var elem = form.elements[e];
-            if (_RT.exists(elem,"name") && elem.name === nameOrIdenitifier) return elem;
-            if (_RT.exists(elem,"id") && elem.id === nameOrIdenitifier) return elem;
+            if (elem.name && elem.name === nameId) return elem;
+            if (elem.id && elem.id === nameId) return elem;
         } // end of for (formElements)
         return null;
     }
@@ -547,12 +551,20 @@ myfaces._impl.core._Runtime.singletonExt
     /**
      * bugfixing for ie6 which does not cope properly with setAttribute
      */
-    setAttribute : function(domNode, attribute, value) {
+    setAttribute : function(node, attr, val) {
+
+        if (!node) {
+            throw Error("_Dom.setAttribute a  node must be given");
+        }
+        if (!attr) {
+            throw Error("_Dom.setAttribute an attribute must be given");
+        }
 
         //quirks mode and ie7 mode has the attributes problems ie8 standards mode behaves like
         //a good citizen
-        if (!myfaces._impl.core._Runtime.browser.isIE || myfaces._impl.core._Runtime.browser.isIE > 7) {
-            domNode.setAttribute(attribute, value);
+        var _Browser = myfaces._impl.core._Runtime.browser;
+        if (!_Browser.isIE || _Browser.isIE > 7) {
+            node.setAttribute(attr, val);
             return;
         }
         var _Lang = myfaces._impl._util._Lang;
@@ -578,44 +590,45 @@ myfaces._impl.core._Runtime.singletonExt
          The lowest common denominator tested within this code
          is IE6, older browsers for now are legacy!
          */
-        attribute = attribute.toLowerCase();
+        attr = attr.toLowerCase();
 
-        if (attribute === "class") {
-            domNode.setAttribute("className", value);
-        } else if (attribute === "for") {
+        if (attr === "class") {
+            node.setAttribute("className", val);
+        } else if (attr === "for") {
 
-            domNode.setAttribute("htmlFor", value);
-        } else if (attribute === "style") {
+            node.setAttribute("htmlFor", val);
+        } else if (attr === "style") {
             //We have to split the styles here and assign them one by one
-            var styleEntries = value.split(";");
-            var styleEntriesLen = styleEntries.length;
-            for (var loop = 0; loop < styleEntriesLen; loop++) {
-                var keyVal = styleEntries[loop].split(":");
+            var styles = val.split(";");
+            var stylesLen = styles.length;
+            for (var loop = 0; loop < stylesLen; loop++) {
+                var keyVal = styles[loop].split(":");
                 if (keyVal[0] != "" && keyVal[0] == "opacity") {
                     //special ie quirks handling for opacity
 
                     var opacityVal = Math.max(100, Math.round(parseFloat(keyVal[1]) * 10));
-                    domNode.style.setAttribute("filter", "alpha(opacity=" + opacityVal + ")");
+                    node.style.setAttribute("filter", "alpha(opacity=" + opacityVal + ")");
                     //if you need more hacks I would recommend
                     //to use the class attribute and conditional ie includes!
                 } else if (keyVal[0] != "") {
-                    domNode.style.setAttribute(keyVal[0], keyVal[1]);
+                    node.style.setAttribute(keyVal[0], keyVal[1]);
                 }
             }
         } else {
             //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.IE_QUIRKS_EVENTS[attribute]) {
-                if (_Lang.isString(attribute)) {
-                    domNode.setAttribute(attribute, function(event) {
+            if (this.IE_QUIRKS_EVENTS[attr]) {
+                if (_Lang.isString(attr)) {
+                    //event resolves to window.event in ie
+                    node.setAttribute(attr, function() {
                         //event implicitly used
-                        return _Lang.globalEval(value);
+                        return _Lang.globalEval(val);
                     });
                 }
             } else {
                 //unknown cases we try to catch them via standard setAttributes
-                domNode.setAttribute(attribute, value);
+                node.setAttribute(attr, val);
             }
         }
     },
@@ -626,41 +639,42 @@ myfaces._impl.core._Runtime.singletonExt
      * 2 inputHidden fields with ID jsf_tree_64 & jsf_state_64 ->
      * http://www.arcknowledge.com/gmane.comp.jakarta.myfaces.devel/2005-09/msg01269.html
      *
-     * @param {String} itemIdOrName - ID of the HTML element located inside the form
+     * @param {String} nameId - ID of the HTML element located inside the form
      * @param {Node} form - form element containing the element
      * @param {boolean} nameSearch if set to true a search for name is also done
-     * @param {boolean} localSearchOnly if set to true a local search is performed only (a full document search is omitted)
+     * @param {boolean} localOnly if set to true a local search is performed only (a full document search is omitted)
      * @return {Object}   the element if found else null
      *
      */
-    getElementFromForm : function(itemIdOrName, form, nameSearch, localSearchOnly) {
+    getElementFromForm : function(nameId, form, nameSearch, localOnly) {
         var _Lang = myfaces._impl._util._Lang;
 
-        if ('undefined' == typeof form || form == null) {
-            return this.findById(document, itemIdOrName);
+        if (!nameId) {
+            throw Error("_Dom.getElementFromForm an item id or name must be given");
         }
 
+        if (!form) {
+            return this.byId(nameId);
+        }
 
-        var isNameSearch = ('undefined' == typeof nameSearch || nameSearch == null)? false: nameSearch;
-        var isLocalSearchOnly = ('undefined' == typeof localSearchOnly || localSearchOnly == null)? false: localSearchOnly;
-
-
-        var fLen = form.elements.length;
+        var isNameSearch = !!nameSearch;
+        var isLocalSearchOnly = !!localOnly;
 
         //we first check for a name entry!
-        if (isNameSearch && _Lang.exists(form, "elements." + itemIdOrName)) {
-            return form.elements[itemIdOrName];
+        if (isNameSearch && _Lang.exists(form, "elements." + nameId)) {
+            return form.elements[nameId];
         }
-        //if no name entry is found we check for an Id
-        var element = this.findById(form, itemIdOrName);
-        if(element != null)  {
+
+        //if no name entry is found we check for an Id but only in the form
+        var element = this.findById(form, nameId);
+        if (element) {
             return element;
         }
 
         // element not found inside the form -> try document.getElementById
-        // (kann be null if element doesn't exist)
+        // (can be null if element doesn't exist)
         if (!isLocalSearchOnly) {
-            return this.findById(document, itemIdOrName);
+            return this.byId(nameId);
         }
 
         return null;
@@ -697,37 +711,37 @@ myfaces._impl.core._Runtime.singletonExt
      * to support the integration of existing ajax libraries which do heavy dom manipulation on the
      * controls side (Dojos Dijit library for instance).
      *
-     * @param {Node} element - element as source, can be detached, undefined or null
+     * @param {Node} elem - element as source, can be detached, undefined or null
      *
      * @return either null or a form node if it could be determined
      */
-    fuzzyFormDetection : function(element) {
-        if (0 == document.forms.length) {
+    fuzzyFormDetection : function(elem) {
+        if (!document.forms || !document.forms.length) {
             return null;
         } else if (1 == document.forms.length) {
             return document.forms[0];
         }
-        if ('undefined' == typeof element || null == element) {
+        if (!elem) {
             return null;
         }
         var _Lang = myfaces._impl._util._Lang;
 
         //before going into the more complicated stuff we try the simple approach
-        if (!_Lang.isString(element)) {
-            return this.getParent(element, "form");
+        if (!_Lang.isString(elem)) {
+            return this.getParent(elem, "form");
         }
 
-        var submitIdentifier = (_Lang.exists(element, "id")) ? element.id : null;
-        var submitName = (_Lang.exists.exists(element, "name")) ? element.name : null;
+        var id = elem.id || null;
+        var name = elem.name || null;
         //a framework in a detachment case also can replace an existing identifier element
         // with a name element
-        submitName = ('undefined' == typeof submitName || null == submitName) ? submitIdentifier : submitName;
+        name = name || id;
         var foundForm;
 
-        if ('undefined' != typeof submitIdentifier && null != submitIdentifier && '' != submitIdentifier) {
+        if (id && '' != id) {
             //we have to assert that the element passed down is detached
-            var domElement = myfaces._impl._util._Lang.byId(submitIdentifier);
-            if ('undefined' != typeof domElement && null != domElement) {
+            var domElement = this.byId(id);
+            if (domElement) {
                 foundForm = this.getParent(domElement, "form");
                 if (null != foundForm) return foundForm;
             }
@@ -736,46 +750,42 @@ myfaces._impl.core._Runtime.singletonExt
         /**
          * name check
          */
-        var foundElements = new Array();
+        var foundElements = [];
 
         /**
          * the lesser chance is the elements which have the same name
          * (which is the more likely case in case of a brute dom replacement)
          */
-        var namedFoundElements = document.getElementsByName(submitName);
-        if (null != namedFoundElements) {
-            for (var cnt = 0; cnt < namedFoundElements.length; cnt++) {
+        var nameElems = document.getElementsByName(name);
+        if (nameElems) {
+            for (var cnt = 0; cnt < nameElems.length && foundElements.length < 2; cnt++) {
                 // we already have covered the identifier case hence we only can deal with names,
-                foundForm = this.getParent(namedFoundElements[cnt], "form");
+                foundForm = this.getParent(nameElems[cnt], "form");
                 if (null != foundForm) {
                     foundElements.push(foundForm);
                 }
             }
         }
 
-        if (null == foundElements || 0 == foundElements.length || foundElements.length > 1) {
-            return null;
-        }
-
-        return foundElements[0];
+        return (1 == foundElements.length ) ? foundElements[0] : null;
     }
     ,
 
     /**
      * gets a parent of an item with a given tagname
      * @param {Node} item - child element
-     * @param {String} tagNameToSearchFor - TagName of parent element
+     * @param {String} tagName - TagName of parent element
      */
-    getParent : function(item, tagNameToSearchFor) {
+    getParent : function(item, tagName) {
 
-        if ('undefined' == typeof item || null == item) {
-            throw Error("myfaces._impl._util._Dom.getParent: item is null or undefined,this not allowed");
+        if (!item) {
+            throw Error("myfaces._impl._util._Dom.getParent: item must be set");
         }
 
         var _Lang = myfaces._impl._util._Lang;
         var searchClosure = function(parentItem) {
-            return parentItem != null && _Lang.exists(parentItem, "tagName")
-                    && _Lang.equalsIgnoreCase(parentItem.tagName, tagNameToSearchFor);
+            return parentItem && parentItem.tagName
+                    && _Lang.equalsIgnoreCase(parentItem.tagName, tagName);
         };
 
         return this.getFilteredParent(item, searchClosure);
@@ -790,21 +800,20 @@ myfaces._impl.core._Runtime.singletonExt
      * @param {function} filter the filter closure
      */
     getFilteredParent : function(item, filter) {
-        if ('undefined' == typeof item || null == item) {
-            throw Error("myfaces._impl._util._Dom.getParen: item is null or undefined,this not allowed");
+        if (!item) {
+            throw Error("myfaces._impl._util._Dom.getFilteredParent: item must be set");
+        }
+        if (!filter) {
+            throw Error("myfaces._impl._util._Dom.getFilteredParent: filter must be set");
         }
 
         //search parent tag parentName
-        var parentItem = ('undefined' != typeof item.parentNode) ? item.parentNode : null;
+        var parentItem = (item.parentNode) ? item.parentNode : null;
 
-        while ('undefined' != typeof parentItem && null != parentItem && !filter(parentItem)) {
+        while (parentItem && !filter(parentItem)) {
             parentItem = parentItem.parentNode;
         }
-        if ('undefined' != typeof parentItem && null != parentItem) {
-            return parentItem;
-        } else {
-            return null;
-        }
+        return (parentItem) ? parentItem : null;
     }
     ,
 
@@ -817,13 +826,20 @@ myfaces._impl.core._Runtime.singletonExt
      * @param filter the filter closure
      */
     getFilteredChild: function(item, filter) {
-        var childItems = item.childNodes;
-        if ('undefined' == typeof childItems || null == childItems) {
+        if (!item) {
+            throw Error("myfaces._impl._util._Dom.getFilteredChild: item must be set");
+        }
+        if (!filter) {
+            throw Error("myfaces._impl._util._Dom.getFilteredChild: filter must be set");
+        }
+
+        var childs = item.childNodes;
+        if (!childs) {
             return null;
         }
-        for (var c = 0, cLen = childItems.length; c < cLen; c++) {
-            if (filter(childItems[c])) {
-                return childItems[c];
+        for (var c = 0, cLen = childs.length; c < cLen; c++) {
+            if (filter(childs[c])) {
+                return childs[c];
             }
         }
         return null;
@@ -840,9 +856,9 @@ myfaces._impl.core._Runtime.singletonExt
     getChild: function(item, childName, itemName) {
 
         function filter(node) {
-            return node.tagName != null
+            return node.tagName
                     && node.tagName.toLowerCase() == childName
-                    && (itemName == null || (itemName != null && itemName == node.getAttribute("name")));
+                    && (!itemName || (itemName && itemName == node.getAttribute("name")));
 
         }
 
@@ -946,20 +962,18 @@ myfaces._impl.core._Runtime.singletonExt
      * contains a set of CDATA blocks to one big string
      * @param {Node} node the node to concat its blocks for
      */
-    concatCDATABlocks
-            :
-            function(/*Node*/ node) {
-                var cDataBlock = [];
-                // response may contain several blocks
-                for (var i = 0; i < node.childNodes.length; i++) {
-                    cDataBlock.push(node.childNodes[i].data);
-                }
-                return cDataBlock.join('');
-            }
+    concatCDATABlocks : function(/*Node*/ node) {
+        var cDataBlock = [];
+        // response may contain several blocks
+        for (var i = 0; i < node.childNodes.length; i++) {
+            cDataBlock.push(node.childNodes[i].data);
+        }
+        return cDataBlock.join('');
+    }
     ,
 
-    byId: function(identifier) {
-        return myfaces._impl._util._Lang.byId(identifier);
+    byId: function(id) {
+        return myfaces._impl._util._Lang.byId(id);
     }
 })
         ;

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_HtmlStripper.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_HtmlStripper.js?rev=946969&r1=946968&r2=946969&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_HtmlStripper.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_HtmlStripper.js Fri May 21 10:51:20 2010
@@ -55,6 +55,7 @@
  * </p>
  */
 
+/** @namespace myfaces._impl._util._HtmlStripper */
 myfaces._impl.core._Runtime.extendClass("myfaces._impl._util._HtmlStripper", Object, {
     BEGIN_TAG: "html",
     END_TAG: "lmth",
@@ -83,17 +84,8 @@ myfaces._impl.core._Runtime.extendClass(
 
         this._tokenForward = 1;
 
-        if ('undefined' == typeof tagNameStart || null == tagNameStart) {
-            this.tagNameStart = this.BEGIN_TAG;
-        } else {
-            this.tagNameStart = tagNameStart;
-        }
-
-        if ('undefined' == typeof tagNameEnd || null == tagNameEnd) {
-            this.tagNameEnd = this.tagNameStart.split("").reverse().join("");
-        } else {
-            this.tagNameEnd = tagNameEnd.split("").reverse().join("");
-        }
+        this.tagNameStart = (!tagNameStart) ? this.BEGIN_TAG : tagNameStart;
+        this.tagNameEnd = (!tagNameEnd) ? this.tagNameStart.split("").reverse().join("") : tagNameEnd.split("").reverse().join("");
 
         this.handleInstructionBlock();
 
@@ -432,12 +424,9 @@ myfaces._impl.core._Runtime.extendClass(
 
         var keyValuePairs = {};
         var currentWord = [];
-        var currentKey = null;
-        var openKey = false;
-        var lastKey = null;
         while (this.tokens[this._tokenPos] != ">") {
-            var currentWord = this._fetchWord();
-            var token = this._getCurrentToken();
+            currentWord = this._fetchWord();
+            token = this._getCurrentToken();
 
             if (token == "=") {
                 this._tokenPos += this._tokenForward;
@@ -559,9 +548,7 @@ myfaces._impl.core._Runtime.extendClass(
      */
     handleComment : function(reverse) {
         this._assertValues(["-","-"]);
-        if ('undefined' == typeof reverse || null == reverse) {
-            reverse = false;
-        }
+        reverse = !!reverse;
 
         while (this._tokenPos < this.tokens.length - 3) {
             //lookahead3, to save some code
@@ -582,11 +569,11 @@ myfaces._impl.core._Runtime.extendClass(
                     token = this._getCurrentToken();
                     backTrackBuf.push(token);
                 }
-                backTrackBuf = backTrackBuf.join("");
+                var sBackTrackBuf = backTrackBuf.join("");
 
-                if (reverse && backTrackBuf == "<!--") {
+                if (reverse && sBackTrackBuf == "<!--") {
                     return;
-                } else if (!reverse && backTrackBuf == "-->") {
+                } else if (!reverse && sBackTrackBuf == "-->") {
                     return;
                 }
             } else {
@@ -610,7 +597,7 @@ myfaces._impl.core._Runtime.extendClass(
      */
     _skipBlank : function(skipVal) {
         var len = this.tokens.length;
-        if ('undefined' == typeof  skipVal || null == skipVal) {
+        if (!skipVal) {
             skipVal = 0;
         }
 
@@ -636,8 +623,7 @@ myfaces._impl.core._Runtime.extendClass(
         tagName.push(this._getCurrentToken());
         this._tokenPos += this._tokenForward;
 
-        tagName = tagName.join("").toLowerCase();
-        return tagName;
+        return tagName.join("").toLowerCase();
     }
 
 });

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=946969&r1=946968&r2=946969&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 Fri May 21 10:51:20 2010
@@ -26,32 +26,42 @@
  space is not worth the loss of readability
  */
 
-myfaces._impl.core._Runtime.singletonExtendClass("myfaces._impl._util._Lang", Object, {
+//Intellij Warnings settings
+/** @namespace myfaces._impl._util._Lang */
+/** @namespace window.console */
+ myfaces._impl.core._Runtime.singletonExtendClass("myfaces._impl._util._Lang", Object, {
 
-    fetchNamespace : function(namespacing) {
-        return myfaces._impl.core._Runtime.fetchNamespace(namespacing);
+    fetchNamespace : function(namespace) {
+        if(!namespace || !this.isString(namespace)) {
+            throw Error("_Lang.fetchNamespace namespace must be of type String");
+        }
+        return myfaces._impl.core._Runtime.fetchNamespace(namespace);
     },
 
-    reserveNamespace : function(namespacing) {
-        return myfaces._impl.core._Runtime.reserveNamespace(namespacing);
+    reserveNamespace : function(namespace) {
+        if(!this.isString(namespace)) {
+            throw Error("_Lang.reserveNamespace namespace must be of type String");
+        }
+        return myfaces._impl.core._Runtime.reserveNamespace(namespace);
     },
 
     globalEval : function(code) {
+        if(!this.isString(code)) {
+            throw Error("_Lang.globalEval code must be of type String");
+        }
         return myfaces._impl.core._Runtime.globalEval(code);
     },
 
     /**
      * cross port from the dojo lib
      * browser save event resolution
-     * @param event the event object
+     * @param evt the event object
      * (with a fallback for ie events if none is present)
      */
-    getEventTarget: function(event) {
-        if (!event) {
-            //ie6 and 7 fallback
-            event = window.event || {};
-        }
-        var t = (event.srcElement ? event.srcElement : (event.target ? event.target : null));
+    getEventTarget: function(evt) {
+        //ie6 and 7 fallback
+        evt = (!evt) ? window.event || {} : evt;
+        var t = (evt.srcElement ? evt.srcElement : (evt.target ? evt.target : null));
         while ((t) && (t.nodeType != 1)) {
             t = t.parentNode;
         }
@@ -61,8 +71,8 @@ myfaces._impl.core._Runtime.singletonExt
     /**
      * check if an element exists in the root
      */
-    exists : function(root, element) {
-        return myfaces._impl.core._Runtime.exists(root, element);
+    exists : function(root, subNamespace) {
+        return myfaces._impl.core._Runtime.exists(root, subNamespace);
     },
 
     /**
@@ -107,10 +117,10 @@ myfaces._impl.core._Runtime.singletonExt
      * @param {Object} reference the reference which has to be byIded
      */
     byId : function(/*object*/ reference) {
-        if (this.isString(reference)) {
-            return document.getElementById(reference);
+        if (!reference) {
+            throw Error("_Lang.byId , a reference node or identifier must be provided");
         }
-        return reference;
+        return (this.isString(reference)) ? document.getElementById(reference) : reference;
     },
 
     /**
@@ -122,31 +132,33 @@ myfaces._impl.core._Runtime.singletonExt
      properties.
      * @param {int} offset the location in obj to start iterating from. Defaults to 0.
      Optional.
-     * @param {Array} startWith An array to pack with the properties of obj. If provided,
+     * @param {Array} packArr An array to pack with the properties of obj. If provided,
      properties in obj are appended at the end of startWith and
      startWith is the returned array.
      */
-    _toArray : function(obj, offset, startWith) {
-        //	summary:
-        //		Converts an array-like object (i.e. arguments, DOMCollection) to an
-        //		array. Returns a new Array with the elements of obj.
-        //	obj:
-        //		the object to "arrayify". We expect the object to have, at a
-        //		minimum, a length property which corresponds to integer-indexed
-        //		properties.
-        //	offset:
-        //		the location in obj to start iterating from. Defaults to 0.
-        //		Optional.
-        //	startWith:
-        //		An array to pack with the properties of obj. If provided,
-        //		properties in obj are appended at the end of startWith and
-        //		startWith is the returned array.
-        var arr = startWith || [];
-        for (var x = offset || 0; x < obj.length; x++) {
-            arr.push(obj[x]);
-        }
-        return arr; // Array
-    },
+    /*_toArray : function(obj, offset, packArr) {
+     //	summary:
+     //		Converts an array-like object (i.e. arguments, DOMCollection) to an
+     //		array. Returns a new Array with the elements of obj.
+     //	obj:
+     //		the object to "arrayify". We expect the object to have, at a
+     //		minimum, a length property which corresponds to integer-indexed
+     //		properties.
+     //	offset:
+     //		the location in obj to start iterating from. Defaults to 0.
+     //		Optional.
+     //	startWith:
+     //		An array to pack with the properties of obj. If provided,
+     //		properties in obj are appended at the end of startWith and
+     //		startWith is the returned array.
+     var arr = packArr || [];
+     //TODO add splicing here
+
+     for (var x = offset || 0; x < obj.length; x++) {
+     arr.push(obj[x]);
+     }
+     return arr; // Array
+     }, */
 
     /**
      * Helper function to provide a trim with a given splitter regular expression
@@ -172,12 +184,15 @@ myfaces._impl.core._Runtime.singletonExt
         if (!this.isString(it)) {
             throw Error("myfaces._impl._util._Lang.strToArray param not of type string");
         }
-        var resultArr = it.split(splitter);
-        var len = resultArr.length;
+        if (!splitter) {
+            throw Error("myfaces._impl._util._Lang.strToArray a splitter param must be provided which is either a tring or a regexp");
+        }
+        var retArr = it.split(splitter);
+        var len = retArr.length;
         for (var cnt = 0; cnt < len; cnt++) {
-            resultArr[cnt] = this.trim(resultArr[cnt]);
+            retArr[cnt] = this.trim(retArr[cnt]);
         }
-        return resultArr;
+        return retArr;
     },
 
     /**
@@ -186,7 +201,9 @@ myfaces._impl.core._Runtime.singletonExt
      * crossported from dojo
      */
     trim : function(/*string*/ str) {
-
+       if(!this.isString(str)) {
+            throw Error("_Lang.trim, parameter must be of type String");
+        }
         str = str.replace(/^\s\s*/, '');
         var ws = /\s/;
         var i = str.length;
@@ -195,17 +212,6 @@ myfaces._impl.core._Runtime.singletonExt
     },
 
     /**
-     * Splits a string and fetches the last element of the String
-     * @param {String} theString the string to be splitted
-     * @param {String} delimiter a delimiting string regexp
-     *
-     */
-    splitAndGetLast : function(theString, delimiter) {
-        var arr = theString.split(delimiter);
-        return arr[arr.length - 1];
-    },
-
-    /**
      * Backported from dojo
      * a failsafe string determination method
      * (since in javascript String != "" typeof alone fails!)
@@ -276,11 +282,11 @@ myfaces._impl.core._Runtime.singletonExt
     ,
 
     _hitchArgs : function(scope, method /*,...*/) {
-        var pre = this._toArray(arguments, 2);
+        var pre = this.objToArray(arguments, 2);
         var named = this.isString(method);
         return function() {
             // array-fy arguments
-            var args = this._toArray(arguments);
+            var args = this.objToArray(arguments);
             // locate our method
             var f = named ? (scope || this.global)[method] : method;
             // invoke with collected args
@@ -292,52 +298,59 @@ myfaces._impl.core._Runtime.singletonExt
     /**
      * Helper function to merge two maps
      * into one
-     * @param {|Object|} destination the destination map
-     * @param {|Object|} source the source map
-     * @param {|boolean|} overwriteDest if set to true the destination is overwritten if the keys exist in both maps
+     * @param {|Object|} dest the destination map
+     * @param {|Object|} src the source map
+     * @param {|boolean|} overwrite if set to true the destination is overwritten if the keys exist in both maps
      **/
-    mixMaps : function(destination, source, overwriteDest) {
+    mixMaps : function(dest, src, overwrite) {
+        if(!dest || !src) {
+            throw Error("_Lang.mixMaps, both a source as well as a destination map must be provided");
+        }
+
         /**
          * mixing code depending on the state of dest and the overwrite param
          */
-        var _Lang = this;
-        var result = {};
+        var ret = {};
         var keyIdx = {};
         var key = null;
-        for (key in source) {
+        for (key in src) {
             /**
              *we always overwrite dest with source
              *unless overWrite is not set or source does not exist
              *but also only if dest exists otherwise source still is taken
              */
-            if (!overwriteDest) {
+            if (!overwrite) {
                 /**
                  *we use exists instead of booleans because we cannot rely
                  *on all values being non boolean, we would need an elvis
                  *operator in javascript to shorten this :-(
                  */
-                result[key] = _Lang.exists(dest, key) ? destination[key] : source[key];
+                ret[key] = this.exists(dest, key) ? dest[key] : src[key];
             } else {
-                result[key] = _Lang.exists(source, key) ? source[key] : destination[key];
+                ret[key] = this.exists(src, key) ? src[key] : dest[key];
             }
             keyIdx[key] = true;
         }
-        for (key in destination) {
+        for (key in dest) {
             /*if result.key does not exist we push in dest.key*/
-            result[key] = _Lang.exists(result, key) ? result[key] : destination[key];
+            ret[key] = this.exists(ret, key) ? ret[key] : dest[key];
         }
-        return result;
+        return ret;
     }
     ,
 
     /**
      * checks if an array contains an element
      * @param {Array} arr   array
-     * @param {String} string_name string to check for
+     * @param {String} str string to check for
      */
-    arrayContains : function(arr, string_name) {
-        for (var loop = 0; loop < arr.length; loop++) {
-            if (arr[loop] == string_name) {
+    contains : function(arr, str) {
+        if(!arr || !str) {
+            throw Error("_Lang.contains an array and a string must be provided");
+        }
+
+        for (var cnt = 0; cnt < arr.length; cnt++) {
+            if (arr[cnt] == str) {
                 return true;
             }
         }
@@ -355,34 +368,26 @@ myfaces._impl.core._Runtime.singletonExt
      * TODO check if this is still needed it is somewhat outside of the scope of the function
      * and functionality wise dirty
      */
-    arrayToString : function(/*String or array*/ arr, /*string*/ delimiter) {
+    arrToString : function(/*String or array*/ arr, /*string*/ delimiter) {
+        if(!arr) {
+            throw Error("_Lang.arrayToString array must be set");
+        }
         if (this.isString(arr)) {
             return arr;
         }
-        var finalDelimiter = (null == delimiter) ? "\n" : delimiter;
 
-        var resultArr = [];
-        for (var cnt = 0; cnt < arr.length; cnt ++) {
-            if (this.isString(arr[cnt])) {
-                resultArr.push(((delimiter == null) ? ("[" + cnt + "] ") : "") + arr[cnt]);
-            } else {
-                resultArr.push(((delimiter == null) ? ("[" + cnt + "] ") : "") + arr[cnt].toString());
-            }
-        }
-        return resultArr.join(finalDelimiter);
-    }
-    ,
+        delimiter = delimiter || "\n";
+        return arr.join(delimiter);
+    },
 
     /**
      * general type assertion routine
      *
      * @param probe the probe to be checked for the correct type
-     * @param type the type to be checked for
+     * @param theType the type to be checked for
      */
-    _assertType : function(probe, type) {
-        if (type != typeof probe) {
-            throw Error("probe must be of type " + type);
-        }
+    assertType : function(probe, theType) {
+        return this.isString(theType) ? probe == typeof theType : probe instanceof theType;
     },
 
     /**
@@ -392,36 +397,19 @@ myfaces._impl.core._Runtime.singletonExt
      */
     addOnLoad: function(func) {
         var oldonload = window.onload;
-        if (typeof window.onload != "function") {
-            window.onload = func;
-        } else {
-            window.onload = function() {
-                oldonload();
-                func();
-            }
-        }
-    },
-    /**
-     * Simple simple logging only triggering at
-     * firebug compatible logging consoles
-     *
-     * note: ;; means the code will be stripped
-     * from the production code by the build system
-     */
-    _logToContainer: function(styleClass /*+arguments*/, loggingArguments) {
-        var loggingContainer = document.getElementById("myfaces.logging");
-        if (loggingContainer) {
-            var element = document.createElement("div");
-            //element.className = styleClass;
-            element.innerHTML = loggingArguments.join(" ");
-            loggingContainer.appendChild(element);
-        }
+        window.onload = (!this.assertType( window.onload, "function")) ? func : function() {
+            oldonload();
+            func();
+        };
     },
 
-    objToArray: function(obj) {
 
+    objToArray: function(obj, offset, pack) {
+        //since offset is numeric we cannot use the shortcut due to 0 being false
+        var finalOffset = ('undefined' != typeof offset || null != offset) ? offset : 0;
+        var finalPack = pack || [];
         try {
-            return Array.prototype.slice.call(obj, 0);
+            return finalPack.concat(Array.prototype.slice.call(obj, finalOffset));
         } catch (e) {
             //ie8 (again as only browser) delivers for css 3 selectors a non convertible object
             //we have to do it the hard way
@@ -429,11 +417,10 @@ myfaces._impl.core._Runtime.singletonExt
             //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]);
+            for (var cnt = finalOffset; cnt < obj.length; cnt++) {
+                finalPack.push(obj[cnt]);
             }
-            return retVal;
+            return finalPack;
         }
 
     },
@@ -493,23 +480,30 @@ myfaces._impl.core._Runtime.singletonExt
 
     /**
      * helper to automatically apply a delivered arguments map or array
-     * to its destination which has a field "_"<key>
+     * to its destination which has a field "_"<key> and a full field
      *
-     * @param destination the destination object
+     * @param dest the destination object
      * @param args the arguments array or map
      * @param argNames the argument names to be transferred
      */
-    applyArguments: function(destination, args, argNames) {
+    applyArgs: function(dest, args, argNames) {
         if (argNames) {
             for (var cnt = 0; cnt < args.length; cnt++) {
-                if ('undefined' != typeof destination["_" + argNames[cnt]]) {
-                    destination["_" + argNames[cnt]] = args[cnt];
+                //dest can be null or 0 hence no shortcut
+                if ('undefined' != typeof dest["_" + argNames[cnt]]) {
+                    dest["_" + argNames[cnt]] = args[cnt];
+                }
+                if ('undefined' != typeof dest[ argNames[cnt]]) {
+                    dest[argNames[cnt]] = args[cnt];
                 }
             }
         } else {
             for (var key in args) {
-                if ('undefined' != typeof destination["_" +key]) {
-                    destination["_" + key] = args[key];
+                if ('undefined' != typeof dest["_" + key]) {
+                    dest["_" + key] = args[key];
+                }
+                if ('undefined' != typeof dest[key]) {
+                    dest[key] = args[key];
                 }
             }
         }
@@ -521,20 +515,20 @@ myfaces._impl.core._Runtime.singletonExt
      * @param func the function issuing the exception
      * @param error the error object itself (optional)
      */
-    createErrorMessage: function(sourceClass, func, error) {
-        var retVal = [];
+    createErrorMsg: function(sourceClass, func, error) {
+        var ret = [];
 
-        retVal.push(this.keyValToStr("Affected Class: ", sourceClass));
-        retVal.push(this.keyValToStr("Affected Method: ", func));
+        ret.push(this.keyValToStr("Affected Class: ", sourceClass));
+        ret.push(this.keyValToStr("Affected Method: ", func));
 
         if (error) {
-            retVal.push(this.keyValToStr("Error name: ", error.name ? error.name : "undefined"));
-            retVal.push(this.keyValToStr("Error message: ", error.message ? error.message : "undefined"));
-            retVal.push(this.keyValToStr("Error description: ", error.description ? error.description : "undefined"));
-            retVal.push(this.keyValToStr("Error number: ", 'undefined' != typeof error.number ? error.number : "undefined"));
-            retVal.push(this.keyValToStr("Error line number: ", 'undefined' != typeof error.lineNumber ? error.lineNumber : "undefined"));
+            ret.push(this.keyValToStr("Error name: ", error.name ? error.name : "undefined"));
+            ret.push(this.keyValToStr("Error message: ", error.message ? error.message : "undefined"));
+            ret.push(this.keyValToStr("Error description: ", error.description ? error.description : "undefined"));
+            ret.push(this.keyValToStr("Error number: ", 'undefined' != typeof error.number ? error.number : "undefined"));
+            ret.push(this.keyValToStr("Error line number: ", 'undefined' != typeof error.lineNumber ? error.lineNumber : "undefined"));
         }
-        return retVal.join("");
+        return ret.join("");
     },
 
     /**
@@ -544,54 +538,74 @@ myfaces._impl.core._Runtime.singletonExt
      * @param delimiter the delimiter
      */
     keyValToStr: function(key, val, delimiter) {
-        var retVal = [];
-        retVal.push(key);
-        retVal.push(val);
+        var ret = [];
+        ret.push(key);
+        ret.push(val);
         if ('undefined' == typeof delimiter) {
             delimiter = "\n";
         }
-        retVal.push(delimiter);
-        return retVal.join("");
+        ret.push(delimiter);
+        return ret.join("");
     },
 
 
+    /**
+     * Simple simple logging only triggering at
+     * firebug compatible logging consoles
+     *
+     * note: ;; means the code will be stripped
+     * from the production code by the build system
+     */
+    _log: function(styleClass /*+arguments*/, args) {
+        var logHolder = document.getElementById("myfaces.logging");
+        if (logHolder) {
+            var elem = document.createElement("div");
+            //element.className = styleClass;
+            elem.innerHTML = this.objToArray(arguments, 1).join(" ");
+            logHolder.appendChild(elem);
+        }
+    },
+
     logLog: function(/*varargs*/) {
-        var argumentStr = this.objToArray(arguments).join(" ");
-        if (window.console && window.console.log) {
-            window.console.log(argumentStr);
+        var argStr = this.objToArray(arguments).join(" ");
+
+        var c = window.console;
+        if (c && c.log) {
+            c.log(argStr);
         }
-        this._logToContainer("logLog", ["Log:"].concat([argumentStr]));
+        this._log("logLog", "Log:" + argStr);
     },
     logDebug: function(/*varargs*/) {
-        var argumentStr = this.objToArray(arguments).join(" ");
-
-        if (window.console && window.console.debug) {
-            window.console.debug(argumentStr);
+        var argStr = this.objToArray(arguments).join(" ");
+        var c = window.console;
+        if (c && c.debug) {
+            c.debug(argStr);
         }
-        this._logToContainer("logDebug", ["Debug:"].concat([argumentStr]));
+        this._log("logDebug", "Debug:" + argStr);
     },
     logError: function(/*varargs*/) {
-        var argumentStr = this.objToArray(arguments).join(" ");
-
-        if (window.console && window.console.error) {
-            window.console.error(argumentStr);
+        var argStr = this.objToArray(arguments).join(" ");
+        var c = window.console;
+        if (c && c.error) {
+            c.error(argStr);
         }
-        this._logToContainer("logError", ["Error:"].concat([argumentStr]));
+        this._log("logError", "Error:" + argStr);
 
     },
     logInfo: function(/*varargs*/) {
-        var argumentStr = this.objToArray(arguments).join(" ");
-
-        if (window.console && window.console.info) {
-            window.console.info(argumentStr);
+        var argStr = this.objToArray(arguments).join(" ");
+        var c = window.console;
+        if (c && c.info) {
+            c.info(argStr);
         }
-        this._logToContainer("logInfo", ["Info:"].concat([argumentStr]));
+        this._log("logInfo", "Info:" + argStr);
     },
     logWarn: function(/*varargs*/) {
-        var argumentStr = this.objToArray(arguments).join(" ");
-        if (window.console && window.console.warn) {
-            window.console.warn(argumentStr);
+        var argStr = this.objToArray(arguments).join(" ");
+        var c = window.console;
+        if (c && c.warn) {
+            c.warn(argStr);
         }
-        this._logToContainer("logWarn", ["Warn:"].concat([argumentStr]));
+        this._log("logWarn", "Warn:" + argStr);
     }
 });

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ListenerQueue.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ListenerQueue.js?rev=946969&r1=946968&r2=946969&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ListenerQueue.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_ListenerQueue.js Fri May 21 10:51:20 2010
@@ -12,6 +12,8 @@
  * idea:
  * var queue = new myfaces._impl._util._ListenerQueue();
  */
+
+/** @namespace myfaces._impl._util._ListenerQueue */
 myfaces._impl.core._Runtime.extendClass("myfaces._impl._util._ListenerQueue", myfaces._impl._util._Queue, {
 
     constructor_: function() {
@@ -51,22 +53,6 @@ myfaces._impl.core._Runtime.extendClass(
 
     /**
      * generic broadcast with a number of arguments being passed down
-     * @param scope the execution scope for the event callback
-     * @param argument ,...*  the arguments list which has to be passed
-     *                  down the queue function
-     */
-    broadcastScopedEvent : function(scope, /*any*/argument) {
-        var _Lang = myfaces._impl._util._Lang;
-        var _args = _Lang.objToArray(arguments);
-
-        var broadCastFunc = function(element) {
-            element.apply(scope, Array.prototype.slice(_args, 1));
-        };
-        this.each(broadCastFunc);
-    },
-
-    /**
-     * generic broadcast with a number of arguments being passed down
      */
     broadcastEvent : function(/*any*/argument) {
         var _Lang = myfaces._impl._util._Lang;

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Queue.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Queue.js?rev=946969&r1=946968&r2=946969&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Queue.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Queue.js Fri May 21 10:51:20 2010
@@ -13,32 +13,34 @@
  *  under the License.
  */
 
+/** @namespace myfaces._impl._util._Queue */
 myfaces._impl.core._Runtime.extendClass("myfaces._impl._util._Queue", Object, {
     //faster queue by http://safalra.com/web-design/javascript/queues/Queue.js
     //license public domain
     //The trick is to simply reduce the number of slice and slice ops to a bare minimum.
 
-    _queue : null,
-    _queueSpace : 0,
-    _queueSize: -1,
+    _q : null,
+    _space : 0,
+    _size: -1,
 
     constructor_: function() {
-        this._queue = [];
+        this._q = [];
+       
     },
 
     length: function() {
         // return the number of elements in the queue
-        return this._queue.length - this._queueSpace;
+        return this._q.length - this._space;
 
     },
 
     isEmpty: function() {
         // return true if the queue is empty, and false otherwise
-        return (this._queue.length == 0);
+        return (this._q.length == 0);
     },
 
     setQueueSize: function(newSize) {
-        this._queueSize = newSize;
+        this._size = newSize;
         this._readjust();
     },
 
@@ -48,14 +50,14 @@ myfaces._impl.core._Runtime.extendClass(
      * @param element the listener to be added
      */
     enqueue : function(/*function*/element) {
-        this._queue.push(element);
+        this._q.push(element);
         //qeuesize is bigger than the limit we drop one element so that we are
         //back in line
         this._readjust();
     },
 
     _readjust: function() {
-        while (this._queueSize > -1 && this.length() > this._queueSize) {
+        while (this._size > -1 && this.length() > this._size) {
             this.dequeue();
         }
     },
@@ -70,7 +72,7 @@ myfaces._impl.core._Runtime.extendClass(
         var index = this.indexOf(element);
         /*found*/
         if (index != -1) {
-            this._queue.splice(index, 1);
+            this._q.splice(index, 1);
         }
     },
 
@@ -79,20 +81,20 @@ myfaces._impl.core._Runtime.extendClass(
         var element = null;
 
         // check whether the queue is empty
-        if (this._queue.length) {
+        if (this._q.length) {
 
             // fetch the oldest element in the queue
-            element = this._queue[this._queueSpace];
+            element = this._q[this._space];
 
             // update the amount of space and check whether a shift should occur
             //added here a max limit of 30
-            if (++this._queueSpace * 2 >= this._queue.length) {
+            if (++this._space * 2 >= this._q.length) {
 
                 // set the queue equal to the non-empty portion of the queue
-                this._queue = this._queue.slice(this._queueSpace);
+                this._q = this._q.slice(this._space);
 
                 // reset the amount of space at the front of the queue
-                this._queueSpace = 0;
+                this._space = 0;
 
             }
 
@@ -108,10 +110,9 @@ myfaces._impl.core._Runtime.extendClass(
      * @param closure a closure which processes the element
      */
     each: function(closure) {
-        var cnt = this._queueSpace;
-        var len = this._queue.length;
-        for (; cnt < len; cnt++) {
-            closure(this._queue[cnt]);
+        var len = this._q.length;
+        for (var cnt = this._space; cnt < len; cnt++) {
+            closure(this._q[cnt]);
         }
     },
 
@@ -124,21 +125,20 @@ myfaces._impl.core._Runtime.extendClass(
      * @return an array of filtered queue entries
      */
     filter: function(closure) {
-        var retVal = [];
-        var cnt = this._queueSpace;
-        var len = this._queue.length;
-        for (; cnt < len; cnt++) {
-            if (closure(this._queue[cnt])) {
-                retVal.push(this._queue[cnt]);
+        var ret = [];
+        var len = this._q.length;
+        for (var cnt = this._space; cnt < len; cnt++) {
+            if (closure(this._q[cnt])) {
+                ret.push(this._q[cnt]);
             }
         }
-        return retVal;
+        return ret;
     },
 
     indexOf: function(element) {
-        var cnt = this._queueSpace;
-        var len = this._queue.length;
-        while (cnt < len && this._queue[cnt] !== element) {
+        var cnt = this._space;
+        var len = this._q.length;
+        while (cnt < len && this._q[cnt] !== element) {
             cnt += 1;
         }
         /*found*/
@@ -147,8 +147,8 @@ myfaces._impl.core._Runtime.extendClass(
     },
 
     cleanup: function() {
-        this._queue = [];
-        this._queueSpace = 0;
+        this._q = [];
+        this._space = 0;
     }
 });
 

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=946969&r1=946968&r2=946969&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 Fri May 21 10:51:20 2010
@@ -22,6 +22,7 @@
  * we use it internally for testing pages
  * which test the various functions of the framework
  */
+/** @namespace myfaces._impl._util._UnitTest*/
 myfaces._impl.core._Runtime.singletonExtendClass("myfaces._impl._util._UnitTest", Object, {
 
     /**

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js?rev=946969&r1=946968&r2=946969&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js Fri May 21 10:51:20 2010
@@ -12,6 +12,9 @@
  *  limitations under the License.
  *  under the License.
  */
+
+/** @namespace myfaces._impl.core.Impl*/
+/** @namespace myfaces._impl._util._ListenerQueue */
 myfaces._impl.core._Runtime.singletonExtendClass("myfaces._impl.core.Impl", Object, {
 
     //third option myfaces._impl.xhrCoreAjax which will be the new core impl for now
@@ -20,47 +23,47 @@ myfaces._impl.core._Runtime.singletonExt
     /**
      * external event listener queue!
      */
-    _eventListenerQueue : new (myfaces._impl.core._Runtime.getGlobalConfig("eventListenerQueue", myfaces._impl._util._ListenerQueue))(),
+    _evtListeners : new (myfaces._impl.core._Runtime.getGlobalConfig("eventListenerQueue", myfaces._impl._util._ListenerQueue))(),
 
     /**
      * external error listener queue!
      */
-    _errorListenerQueue : new (myfaces._impl.core._Runtime.getGlobalConfig("errorListenerQueue", myfaces._impl._util._ListenerQueue))(),
+    _errListeners : new (myfaces._impl.core._Runtime.getGlobalConfig("errorListenerQueue", myfaces._impl._util._ListenerQueue))(),
 
     /*CONSTANTS*/
 
     /*internal identifiers for options*/
-    _OPT_IDENT_ALL : "@all",
-    _OPT_IDENT_NONE : "@none",
-    _OPT_IDENT_THIS : "@this",
-    _OPT_IDENT_FORM : "@form",
+    IDENT_ALL : "@all",
+    IDENT_NONE : "@none",
+    IDENT_THIS : "@this",
+    IDENT_FORM : "@form",
 
     /*
      * [STATIC] constants
      */
 
-    _PROP_PARTIAL_SOURCE : "javax.faces.source",
-    _PROP_VIEWSTATE : "javax.faces.ViewState",
-    _PROP_AJAX : "javax.faces.partial.ajax",
-    _PROP_EXECUTE : "javax.faces.partial.execute",
-    _PROP_RENDER : "javax.faces.partial.render",
-    _PROP_EVENT : "javax.faces.partial.event",
+    P_PARTIAL_SOURCE : "javax.faces.source",
+    P_VIEWSTATE : "javax.faces.ViewState",
+    P_AJAX : "javax.faces.partial.ajax",
+    P_EXECUTE : "javax.faces.partial.execute",
+    P_RENDER : "javax.faces.partial.render",
+    P_EVT : "javax.faces.partial.event",
 
     /* message types */
-    _MSG_TYPE_ERROR : "error",
-    _MSG_TYPE_EVENT : "event",
+    ERROR : "error",
+    EVENT : "event",
 
     /* event emitting stages */
-    _AJAX_STAGE_BEGIN : "begin",
-    _AJAX_STAGE_COMPLETE : "complete",
-    _AJAX_STAGE_SUCCESS : "success",
+    BEGIN : "begin",
+    COMPLETE : "complete",
+    SUCCESS : "success",
 
     /*ajax errors spec 14.4.2*/
-    _ERROR_HTTPERROR : "httpError",
-    _ERROR_EMPTY_RESPONSE : "emptyResponse",
-    _ERROR_MALFORMEDXML : "malformedXML",
-    _ERROR_SERVER_ERROR : "serverError",
-    _ERROR_CLIENT_ERROR : "clientError",
+    HTTPERROR : "httpError",
+    EMPTY_RESPONSE : "emptyResponse",
+    MALFORMEDXML : "malformedXML",
+    SERVER_ERROR : "serverError",
+    CLIENT_ERROR : "clientError",
 
 
 
@@ -72,66 +75,27 @@ myfaces._impl.core._Runtime.singletonExt
      * @throws error in case of the given element not being of type form!
      * https://issues.apache.org/jira/browse/MYFACES-2110
      */
-    getViewState : function(formElement) {
+    getViewState : function(form) {
         /**
          *  typecheck assert!, we opt for strong typing here
          *  because it makes it easier to detect bugs
          */
-        if ('undefined' != typeof formElement && null != formElement) {
-            formElement = myfaces._impl._util._Lang.byId(formElement);
+        if (form) {
+            form = myfaces._impl._util._Lang.byId(form);
         }
 
-        if ('undefined' == typeof(formElement)
-                || null == formElement
-                || 'undefined' == typeof(formElement.nodeName)
-                || null == formElement.nodeName
-                || formElement.nodeName.toLowerCase() != "form") {
+        if (!form
+                || !form.nodeName
+                || form.nodeName.toLowerCase() != "form") {
             throw new Error("jsf.viewState: param value not of type form!");
         }
 
         var ajaxUtils = new myfaces._impl.xhrCore._AjaxUtils(0);
-        return ajaxUtils.encodeSubmittableFields(null, null, null, formElement, null);
+        return ajaxUtils.encodeSubmittableFields(null, null, null, form, null);
 
     },
 
     /**
-     * internal assertion check for the element parameter
-     * it cannot be null or undefined
-     * it must be either a string or a valid existing dom node
-     */
-    _assertElement : function(/*String|Dom Node*/ element) {
-        /*namespace remap for our local function context we mix the entire function namespace into
-         *a local function variable so that we do not have to write the entire namespace
-         *all the time
-         **/
-        var _Lang = myfaces._impl._util._Lang;
-
-        /**
-         * assert element
-         */
-        if ('undefined' == typeof( element ) || null == element) {
-            throw new Error("jsf.ajax, element must be set!");
-        }
-        //        if (!JSF2Utils.isString(element) && !(element instanceof Node)) {
-        //            throw new Error("jsf.ajax, element either must be a string or a dom node");
-        //        }
-
-        element = _Lang.byId(element);
-        if ('undefined' == typeof element || null == element) {
-            throw new Error("Element either must be a string to a or must be a valid dom node");
-        }
-    },
-
-    _assertFunction : function(func) {
-        if ('undefined' == typeof func || null == func) {
-            return;
-        }
-        if (!(func instanceof Function)) {
-            throw new Error("Functioncall " + func + " is not a function! ");
-        }
-    },
-
-    /**
      * this function has to send the ajax requests
      *
      * following request conditions must be met:
@@ -142,11 +106,11 @@ myfaces._impl.core._Runtime.singletonExt
      *  <li> all requests must be queued with a client side request queue to ensure the request ordering!</li>
      * </ul>
      *
-     * @param {String|Node} element any dom element no matter being it html or jsf, from which the event is emitted
+     * @param {String|Node} elem any dom element no matter being it html or jsf, from which the event is emitted
      * @param {|Event|} event any javascript event supported by that object
      * @param {|Object|} options  map of options being pushed into the ajax cycle
      */
-    request : function(element, event, options) {
+    request : function(elem, event, options) {
 
         /*namespace remap for our local function context we mix the entire function namespace into
          *a local function variable so that we do not have to write the entire namespace
@@ -158,139 +122,148 @@ myfaces._impl.core._Runtime.singletonExt
          * we cross reference statically hence the mapping here
          * the entire mapping between the functions is stateless
          */
-        element = _Lang.byId(element);
-        event = ('undefined' == typeof event && window.event) ? window.event : event;
+        //null definitely means no event passed down so we skip the ie specific checks
+        if('undefined' == typeof event) {
+            event = window.event || null;
+        }
+
+        elem = _Lang.byId(elem);
 
-        if ('undefined' != typeof element && null != element) {
+        if (elem) {
             //detached element handling, we also store the element name
             //to get a fallback option in case the identifier is not determinable
             // anymore, in case of a framework induced detachment the element.name should
             // be shared if the identifier is not determinable anymore
-            elementId = ('undefined' != typeof element.id) ? element.id : null;
-            if ((elementId == null || elementId == '') && 'undefined' != typeof element.name) {
-                elementId = element.name;
+            elementId = elem.id || null;
+            if ((elementId == null || elementId == '') && elem.name) {
+                elementId = elem.name;
             }
         }
 
         /*assert if the onerror is set and once if it is set it must be of type function*/
-        this._assertFunction(options.onerror);
+        _Lang.assertType(options.onerror, "function");
         /*assert if the onevent is set and once if it is set it must be of type function*/
-        this._assertFunction(options.onevent);
+        _Lang.assertType(options.onevent, "function");
 
         /*
          * We make a copy of our options because
          * we should not touch the incoming params!
          */
-        var passThroughArguments = _Lang.mixMaps({}, options, true);
+        var passThrgh = _Lang.mixMaps({}, options, true);
 
         /*additional passthrough cleanup*/
         /*ie6 supportive code to prevent browser leaks*/
-        passThroughArguments.onevent = null;
-        delete passThroughArguments.onevent;
+        passThrgh.onevent = null;
+        delete passThrgh.onevent;
         /*ie6 supportive code to prevent browser leaks*/
-        passThroughArguments.onerror = null;
-        delete passThroughArguments.onerror;
+        passThrgh.onerror = null;
+        delete passThrgh.onerror;
 
-        if ('undefined' != typeof event && null != event) {
-            passThroughArguments[this._PROP_EVENT] = event.type;
+        if (event) {
+            passThrgh[this.P_EVT] = event.type;
         }
 
         /**
          * ajax pass through context with the source
          * onevent and onerror
          */
-        var ajaxContext = {};
-        ajaxContext.source = element;
-        ajaxContext.onevent = options.onevent;
-        ajaxContext.onerror = options.onerror;
+        var context = {};
+        context.source = elem;
+        context.onevent = options.onevent;
+        context.onerror = options.onerror;
 
         /**
          * fetch the parent form
          */
 
-        var sourceForm = myfaces._impl._util._Dom.fuzzyFormDetection(element);
-        var _Lang = myfaces._impl._util._Lang;
-        if (null == sourceForm && 'undefined' != typeof event && null != event) {
-            sourceForm = myfaces._impl._util._Dom.fuzzyFormDetection(_Lang.getEventTarget(event));
-            if (null == sourceForm) {
-                throw Error("Sourceform could not be determined, either because element is not attached to a form or we have multiple forms with named elements of the same identifier or name, stopping the ajax processing");
+        var form = myfaces._impl._util._Dom.fuzzyFormDetection(elem);
+
+        var formErr = "Sourceform could not be determined, either because element is not attached to a form or we have multiple forms with named elements of the same identifier or name, stopping the ajax processing";
+
+        if (!form && event) {
+            form = myfaces._impl._util._Dom.fuzzyFormDetection(_Lang.getEventTarget(event));
+            if (!form) {
+                throw Error(formErr);
             }
-        } else if (null == sourceForm) {
-            throw Error("Sourceform could not be determined, either because element is not attached to a form or we have multiple forms with named elements of the same identifier or name, stopping the ajax processing");
+        } else if (!form) {
+            throw Error(formErr);
         }
 
         /**
          * binding contract the javax.faces.source must be set
          */
-        passThroughArguments[this._PROP_PARTIAL_SOURCE] = elementId;
+        passThrgh[this.P_PARTIAL_SOURCE] = elementId;
 
         /**
          * javax.faces.partial.ajax must be set to true
          */
-        passThroughArguments[this._PROP_AJAX] = true;
+        passThrgh[this.P_AJAX] = true;
 
         /**
          * if execute or render exist
          * we have to pass them down as a blank delimited string representation
          * of an array of ids!
          */
-        if (_Lang.exists(passThroughArguments, "execute")) {
+        var exec, none, all, render = null;
+        if (passThrgh.execute) {
             /*the options must be a blank delimited list of strings*/
-            var execString = _Lang.arrayToString(passThroughArguments.execute, ' ');
-            var execNone = execString.indexOf(this._OPT_IDENT_NONE) != -1;
-            var execAll = execString.indexOf(this._OPT_IDENT_ALL) != -1;
-            if (!execNone && !execAll) {
-                execString = execString.replace(this._OPT_IDENT_FORM, sourceForm.id);
-                execString = execString.replace(this._OPT_IDENT_THIS, elementId);
-
-                passThroughArguments[this._PROP_EXECUTE] = execString;
-            } else if (execAll) {
-                passThroughArguments[this._PROP_EXECUTE] = this._OPT_IDENT_ALL;
+            exec = _Lang.arrToString(passThrgh.execute, ' ');
+            none = exec.indexOf(this.IDENT_NONE) != -1;
+            all = exec.indexOf(this.IDENT_ALL) != -1;
+            if (!none && !all) {
+                exec = exec.replace(this.IDENT_FORM, form.id);
+                exec = exec.replace(this.IDENT_THIS, elementId);
+
+                passThrgh[this.P_EXECUTE] = exec;
+            } else if (all) {
+                passThrgh[this.P_EXECUTE] = this.IDENT_ALL;
             }
 
-            passThroughArguments.execute = null;
+            passThrgh.execute = null;
             /*remap just in case we have a valid pointer to an existing object*/
-            delete passThroughArguments.execute;
+            delete passThrgh.execute;
         } else {
-            passThroughArguments[this._PROP_EXECUTE] = elementId;
+            passThrgh[this.P_EXECUTE] = elementId;
         }
 
-        if (_Lang.exists(passThroughArguments, "render")) {
-            var renderString = _Lang.arrayToString(passThroughArguments.render, ' ');
-            var renderNone = renderString.indexOf(this._OPT_IDENT_NONE) != -1;
-            var renderAll = renderString.indexOf(this._OPT_IDENT_ALL) != -1;
-            if (!renderNone && !renderAll) {
-                renderString = renderString.replace(this._OPT_IDENT_FORM, sourceForm.id);
-                renderString = renderString.replace(this._OPT_IDENT_THIS, elementId);
-                passThroughArguments[this._PROP_RENDER] = renderString;
-                passThroughArguments.render = null;
-            } else if (renderAll) {
-                passThroughArguments[this._PROP_RENDER] = this._OPT_IDENT_ALL;
+        if (passThrgh.render) {
+            render = _Lang.arrToString(passThrgh.render, ' ');
+            none = render.indexOf(this.IDENT_NONE) != -1;
+            all = render.indexOf(this.IDENT_ALL) != -1;
+            if (!none && !all) {
+                render = render.replace(this.IDENT_FORM, form.id);
+                render = render.replace(this.IDENT_THIS, elementId);
+                passThrgh[this.P_RENDER] = render;
+                passThrgh.render = null;
+            } else if (all) {
+                passThrgh[this.P_RENDER] = this.IDENT_ALL;
 
             }
-            delete passThroughArguments.render;
+            delete passThrgh.render;
         }
 
         //implementation specific options are added to the context for further processing
-        if ('undefined' != typeof passThroughArguments.myfaces && null != passThroughArguments.myfaces) {
-            ajaxContext.myfaces = passThroughArguments.myfaces;
-            delete passThroughArguments.myfaces;
+        if (passThrgh.myfaces) {
+            context.myfaces = passThrgh.myfaces;
+            delete passThrgh.myfaces;
         }
 
-        this._transport.xhrQueuedPost(element, sourceForm, ajaxContext, passThroughArguments);
+        this._transport.xhrQueuedPost(elem, form, context, passThrgh);
 
     },
 
     addOnError : function(/*function*/errorListener) {
         /*error handling already done in the assert of the queue*/
-        this._errorListenerQueue.enqueue(errorListener);
+        this._errListeners.enqueue(errorListener);
     },
 
     addOnEvent : function(/*function*/eventListener) {
         /*error handling already done in the assert of the queue*/
-        this._eventListenerQueue.enqueue(eventListener);
+        this._evtListeners.enqueue(eventListener);
     },
 
+
+
     /**
      * implementation triggering the error chain
      *
@@ -313,10 +286,10 @@ myfaces._impl.core._Runtime.singletonExt
         var eventData = {};
         //we keep this in a closure because we might reuse it for our serverErrorMessage
         var malFormedMessage = function() {
-            return ('undefined' != typeof name && name == myfaces._impl.core.Impl._ERROR_MALFORMEDXML) ? "The server response could not be parsed, the server has returned with a response which is not xml !" : "";
+            return (name && name === myfaces._impl.core.Impl.MALFORMEDXML) ? "The server response could not be parsed, the server has returned with a response which is not xml !" : "";
         };
 
-        eventData.type = this._MSG_TYPE_ERROR;
+        eventData.type = this.ERROR;
 
         eventData.status = name;
         eventData.serverErrorName = serverErrorName;
@@ -337,15 +310,15 @@ myfaces._impl.core._Runtime.singletonExt
         }
 
         /*now we serve the queue as well*/
-        this._errorListenerQueue.broadcastEvent(eventData);
+        this._errListeners.broadcastEvent(eventData);
 
-        if (jsf.getProjectStage() === "Development" && this._errorListenerQueue.length() == 0) {
+        if (jsf.getProjectStage() === "Development" && this._errListeners.length() == 0) {
             var defaultErrorOutput = myfaces._impl.core._Runtime.getGlobalConfig("defaultErrorOutput", alert);
             var finalMessage = [];
 
-            finalMessage.push(('undefined' != typeof name && null != name) ? name : "");
-            finalMessage.push(('undefined' != typeof serverErrorName && null != serverErrorName) ? serverErrorName : "");
-            finalMessage.push(('undefined' != typeof serverErrorMessage && null != serverErrorMessage) ? serverErrorMessage : "");
+            finalMessage.push((name) ? name : "");
+            finalMessage.push((serverErrorName) ? serverErrorName : "");
+            finalMessage.push((serverErrorMessage) ? serverErrorMessage : "");
             finalMessage.push(malFormedMessage());
 
             defaultErrorOutput(finalMessage.join("-") + " Note, this message is only sent, because project stage is development and no " +
@@ -358,12 +331,12 @@ myfaces._impl.core._Runtime.singletonExt
      */
     sendEvent : function sendEvent(/*Object*/request, /*Object*/ context, /*event name*/ name) {
         var eventData = {};
-        eventData.type = this._MSG_TYPE_EVENT;
+        eventData.type = this.EVENT;
 
         eventData.status = name;
         eventData.source = context.source;
 
-        if (name !== this._AJAX_STAGE_BEGIN) {
+        if (name !== this.BEGIN) {
 
             try {
                 eventData.responseCode = request.status;
@@ -372,7 +345,7 @@ myfaces._impl.core._Runtime.singletonExt
 
             } catch (e) {
                 var impl = myfaces._impl.core._Runtime.getGlobalConfig("jsfAjaxImpl", myfaces._impl.core.Impl);
-                impl.sendError(request, context, this._ERROR_CLIENT_ERROR, "ErrorRetrievingResponse",
+                impl.sendError(request, context, this.CLIENT_ERROR, "ErrorRetrievingResponse",
                         "Parts of the response couldn't be retrieved when constructing the event data: " + e);
                 //client errors are not swallowed
                 throw e;
@@ -381,13 +354,13 @@ myfaces._impl.core._Runtime.singletonExt
         }
 
         /**/
-        if (myfaces._impl._util._Lang.exists(context, "onevent")) {
+        if (context.onevent) {
             /*calling null to preserve the original scope*/
             context.onevent.call(null, eventData);
         }
 
         /*now we serve the queue as well*/
-        this._eventListenerQueue.broadcastEvent(eventData);
+        this._evtListeners.broadcastEvent(eventData);
     },
 
     /**
@@ -412,12 +385,10 @@ myfaces._impl.core._Runtime.singletonExt
         {
             if (scriptTags[i].src.search(/\/javax\.faces\.resource\/jsf\.js.*ln=javax\.faces/) != -1)
             {
-                /* try to extract stage=XXX */
-                var result = scriptTags[i].src.match(/stage=([^&;]*)/);
                 if (result)
                 {
-                    /* we found stage=XXX */
-                    /* return only valid values of ProjectStage */
+                    // we found stage=XXX
+                    // return only valid values of ProjectStage
                     if (result[1] == "Production"
                             || result[1] == "Development"
                             || result[1] == "SystemTest"
@@ -428,7 +399,7 @@ myfaces._impl.core._Runtime.singletonExt
                 }
                 else
                 {
-                    /* we found the script, but there was no stage parameter --> Production */
+                    //we found the script, but there was no stage parameter --> Production
                     return "Production";
                 }
             }
@@ -478,7 +449,7 @@ myfaces._impl.core._Runtime.singletonExt
         //assertions source either null or set as dom element:
 
         if ('undefined' == typeof source) {
-            throw new Error(" source must be defined");
+            throw new Error(" source must be defined or null");
             //allowed chain datatypes
         } else if ('function' == typeof source) {
             throw new Error(" source cannot be a function (probably source and event were not defined or set to null");
@@ -494,23 +465,22 @@ myfaces._impl.core._Runtime.singletonExt
             throw new Error(" an event must be passed down (either a an event object null or undefined) ");
         }
 
-        for (var loop = 2; loop < len; loop++) {
+        for (var cnt = 2; cnt < len; cnt++) {
             //we do not change the scope of the incoming functions
             //but we reuse the argument array capabilities of apply
-            var retVal;
+            var ret;
 
-            if ('function' == typeof arguments[loop]) {
-                retVal = arguments[loop].call(source, event);
+            if ('function' == typeof arguments[cnt]) {
+                ret = arguments[cnt].call(source, event);
             } else {
                 //either a function or a string can be passed in case of a string we have to wrap it into another function
-                retVal = new Function("event", arguments[loop]).call(source, event);
+                ret = new Function("event", arguments[cnt]).call(source, event);
             }
             //now if one function returns false in between we stop the execution of the cycle
             //here, note we do a strong comparison here to avoid constructs like 'false' or null triggering
-            if ('undefined' != typeof retVal && retVal === false) {
+            if (ret === false /*undefined check implicitly done here by using a strong compare*/) {
                 return false;
             }
-
         }
         return true;