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 2009/04/23 13:04:51 UTC

svn commit: r767890 [2/2] - in /myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces: _impl/_util/ _impl/core/ _impl/xhrCore/ api/

Modified: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js?rev=767890&r1=767889&r2=767890&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js (original)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js Thu Apr 23 11:04:51 2009
@@ -21,76 +21,79 @@
 _reserveMyfacesNamespaces();
 
 
-/**
- * Constructor
- * @param {String} alarmThreshold
- */
-myfaces._impl.xhrCore._AjaxResponse = function(alarmThreshold) {
-	this.alarmThreshold = alarmThreshold;
-	this.m_exception = new myfaces._impl.xhrCore._Exception("myfaces._impl.xhrCore._AjaxResponse", this.alarmThreshold);
-};
-
-/*partial response types*/
-myfaces._impl.xhrCore._AjaxResponse.prototype._RESPONSE_PARTIAL         = "partial-response";
-myfaces._impl.xhrCore._AjaxResponse.prototype._RESPONSETYPE_ERROR       = "error";
-myfaces._impl.xhrCore._AjaxResponse.prototype._RESPONSETYPE_REDIRECT    = "redirect";
-myfaces._impl.xhrCore._AjaxResponse.prototype._RESPONSETYPE_REDIRECT    = "changes";
-
-/*partial commands*/
-myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_CHANGES     = "changes";
-myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_UPDATE      = "update";
-myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_DELETE      = "delete";
-myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_INSERT      = "insert";
-myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_EVAL        = "eval";
-myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_ERROR       = "error";
-myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_ATTRIBUTES  = "attributes";
-myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_EXTENSION   = "extension";
-
-/**
- * uses response to start Html element replacement
- * @param {Map} context - AJAX context
- *
- * A special handling has to be added to the update cycle
- * according to the JSDoc specs if the CDATA block contains html tags the outer rim must be stripped
- * if the CDATA block contains a head section the document head must be replaced
- * and if the CDATA block contains a body section the document body must be replaced!
- *
- */
-myfaces._impl.xhrCore._AjaxResponse.prototype.processResponse = function(request, context) {
-	try {
-        // TODO:
-        // Solution from
-        // http://www.codingforums.com/archive/index.php/t-47018.html
-        // to solve IE error 1072896658 when a Java server sends iso88591
-        // istead of ISO-8859-1
-        if ('undefined' == typeof(request) || null == request) {
-            throw Exception("jsf.ajaxResponse: The response cannot be null or empty!");
-        }
-
-        if (!myfaces._impl._util._LangUtils.exists(request, "responseXML")) {
-            jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_EMPTY_RESPONSE);
-            return;
-        }
-
-        var xmlContent = request.responseXML;
-        if (xmlContent.firstChild.tagName == "parsererror") {
-            jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML);
-            return;
-        }
-        var partials = xmlContent.childNodes[0];
-        if ('undefined' == typeof partials || partials == null
-            || partials.tagName != this._RESPONSE_PARTIAL) {
-            jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML);
-            return;
-        }
-
-        var childNodesLength = partials.childNodes.length;
-
-        for (var loop = 0; loop < childNodesLength; loop++) {
-            var childNode = partials.childNodes[loop];
-            var tagName = childNode.tagName;
+if (!myfaces._impl._util._LangUtils.exists(myfaces._impl.xhrCore, "_AjaxResponse")) {
 
-            /**
+
+    /**
+     * Constructor
+     * @param {String} alarmThreshold
+     */
+    myfaces._impl.xhrCore._AjaxResponse = function(alarmThreshold) {
+        this.alarmThreshold = alarmThreshold;
+        this.m_exception = new myfaces._impl.xhrCore._Exception("myfaces._impl.xhrCore._AjaxResponse", this.alarmThreshold);
+    };
+
+    /*partial response types*/
+    myfaces._impl.xhrCore._AjaxResponse.prototype._RESPONSE_PARTIAL         = "partial-response";
+    myfaces._impl.xhrCore._AjaxResponse.prototype._RESPONSETYPE_ERROR       = "error";
+    myfaces._impl.xhrCore._AjaxResponse.prototype._RESPONSETYPE_REDIRECT    = "redirect";
+    myfaces._impl.xhrCore._AjaxResponse.prototype._RESPONSETYPE_REDIRECT    = "changes";
+
+    /*partial commands*/
+    myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_CHANGES     = "changes";
+    myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_UPDATE      = "update";
+    myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_DELETE      = "delete";
+    myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_INSERT      = "insert";
+    myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_EVAL        = "eval";
+    myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_ERROR       = "error";
+    myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_ATTRIBUTES  = "attributes";
+    myfaces._impl.xhrCore._AjaxResponse.prototype._PCMD_EXTENSION   = "extension";
+
+    /**
+     * uses response to start Html element replacement
+     * @param {Map} context - AJAX context
+     *
+     * A special handling has to be added to the update cycle
+     * according to the JSDoc specs if the CDATA block contains html tags the outer rim must be stripped
+     * if the CDATA block contains a head section the document head must be replaced
+     * and if the CDATA block contains a body section the document body must be replaced!
+     *
+     */
+    myfaces._impl.xhrCore._AjaxResponse.prototype.processResponse = function(request, context) {
+        try {
+            // TODO:
+            // Solution from
+            // http://www.codingforums.com/archive/index.php/t-47018.html
+            // to solve IE error 1072896658 when a Java server sends iso88591
+            // istead of ISO-8859-1
+            if ('undefined' == typeof(request) || null == request) {
+                throw Exception("jsf.ajaxResponse: The response cannot be null or empty!");
+            }
+
+            if (!myfaces._impl._util._LangUtils.exists(request, "responseXML")) {
+                jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_EMPTY_RESPONSE);
+                return;
+            }
+
+            var xmlContent = request.responseXML;
+            if (xmlContent.firstChild.tagName == "parsererror") {
+                jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML);
+                return;
+            }
+            var partials = xmlContent.childNodes[0];
+            if ('undefined' == typeof partials || partials == null
+                || partials.tagName != this._RESPONSE_PARTIAL) {
+                jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML);
+                return;
+            }
+
+            var childNodesLength = partials.childNodes.length;
+
+            for (var loop = 0; loop < childNodesLength; loop++) {
+                var childNode = partials.childNodes[loop];
+                var tagName = childNode.tagName;
+
+                /**
                  * <eval>
                  *      <![CDATA[javascript]]>
                  * </eval>
@@ -98,298 +101,300 @@
 
             
 
-            //this ought to be enough for eval
-            //however the run scripts still makes sense
-            //in the update and insert area for components
-            //which do not use the response writer properly
-            //we might add this one as custom option in update and
-            //insert!
-            if (tagName == this._PCMD_ERROR) {
-                this.processError(request, context, childNode);
-                return;
-            } else if (tagName == this._PCMD_REDIRECT) {
-                if (!this.processRedirect(request, context, childNode)) return;
-            } else if (tagName == this._PCMD_CHANGES) {
-                if (!this.processChanges(request, context, childNode)) return;
-            } 
+                //this ought to be enough for eval
+                //however the run scripts still makes sense
+                //in the update and insert area for components
+                //which do not use the response writer properly
+                //we might add this one as custom option in update and
+                //insert!
+                if (tagName == this._PCMD_ERROR) {
+                    this.processError(request, context, childNode);
+                    return;
+                } else if (tagName == this._PCMD_REDIRECT) {
+                    if (!this.processRedirect(request, context, childNode)) return;
+                } else if (tagName == this._PCMD_CHANGES) {
+                    if (!this.processChanges(request, context, childNode)) return;
+                }
+            }
+        } catch (e) {
+            this.m_exception.throwError(request, context, "processResponse", e);
         }
-    } catch (e) {
-        this.m_exception.throwError(request, context, "processResponse", e);
-    }
-};
+    };
 
-myfaces._impl.xhrCore._AjaxResponse.prototype.processError = function(request, context, node) {
-    /**
+    myfaces._impl.xhrCore._AjaxResponse.prototype.processError = function(request, context, node) {
+        /**
      * <error>
      *      <error-name>String</error-name>
      *      <error-message><![CDATA[message]]></error-message>
      * <error>
      */
-    var errorName = node.firstChild.textContent;
-    var errorMessage = node.childNodes[1].firstChild.data;
+        var errorName = node.firstChild.textContent;
+        var errorMessage = node.childNodes[1].firstChild.data;
 
-    if('undefined' == typeof errorName || null == errorName) {
-        errorName = "";
-    }
-    if('undefined' == typeof errorMessage || null == errorMessage) {
-        errorMessage = "";
+        if('undefined' == typeof errorName || null == errorName) {
+            errorName = "";
+        }
+        if('undefined' == typeof errorMessage || null == errorMessage) {
+            errorMessage = "";
+        }
+        jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_SERVER_ERROR , errorName, errorMessage);
     }
-    jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_SERVER_ERROR , errorName, errorMessage);
-}
 
-myfaces._impl.xhrCore._AjaxResponse.prototype.processRedirect = function(request, context, node) {
-    /**
+    myfaces._impl.xhrCore._AjaxResponse.prototype.processRedirect = function(request, context, node) {
+        /**
      * <redirect url="url to redirect" />
      */
-    var redirectUrl = node.getAttribute("url");
-    if('undefined' == typeof redirectUrl || null == redirectUrl) {
-        jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,"Redirect without url");
-        return false;
-    }
-    redirectUrl = myfaces._impl._util._LangUtils.trim(redirectUrl);
-    if(redirectUrl == "") {
-        return false;
+        var redirectUrl = node.getAttribute("url");
+        if('undefined' == typeof redirectUrl || null == redirectUrl) {
+            jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,"Redirect without url");
+            return false;
+        }
+        redirectUrl = myfaces._impl._util._LangUtils.trim(redirectUrl);
+        if(redirectUrl == "") {
+            return false;
+        }
+        window.location = redirectUrl;
+        return true;
     }
-    window.location = redirectUrl;
-    return true;
-}
-
-myfaces._impl.xhrCore._AjaxResponse.prototype.processChanges = function(request, context, node) {
-    var changes = node.childNodes;
-
-    for (var i = 0; i < changes.length; i++) {
-        if (changes[i].tagName == "update") {
-            if (!this.processUpdate(request, context, changes[i])) return false;
-        } else if (changes[i].tagName == this._PCMD_EVAL) {
-            //eval is always in CDATA blocks
-            eval(changes[i].firstChild.data);
-        } else if (changes[i].tagName == this._PCMD_INSERT) {
-            if (!this.processInsert(request, context, changes[i])) return false;
-        } else if (changes[i].tagName == this._PCMD_DELETE) {
-            if (!this.processDelete(request, context, changes[i])) return false;
-        } else if (changes[i].tagName == this._PCMD_ATTRIBUTES) {
-            if (!this.processAttributes(request, context, changes[i])) return false;
-        // this._responseHandler.doAtttributes(childNode);
-        //TODO check the spec if this part is obsolete!!!
-        //} else if (changes[i].tagName == this._PCMD_EXTENSION) {
-        //  this._responseHandler.doExtension(childNode);
 
-        } else {
-            jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML);
-            return false;
+    myfaces._impl.xhrCore._AjaxResponse.prototype.processChanges = function(request, context, node) {
+        var changes = node.childNodes;
+
+        for (var i = 0; i < changes.length; i++) {
+            if (changes[i].tagName == "update") {
+                if (!this.processUpdate(request, context, changes[i])) return false;
+            } else if (changes[i].tagName == this._PCMD_EVAL) {
+                //eval is always in CDATA blocks
+                eval(changes[i].firstChild.data);
+            } else if (changes[i].tagName == this._PCMD_INSERT) {
+                if (!this.processInsert(request, context, changes[i])) return false;
+            } else if (changes[i].tagName == this._PCMD_DELETE) {
+                if (!this.processDelete(request, context, changes[i])) return false;
+            } else if (changes[i].tagName == this._PCMD_ATTRIBUTES) {
+                if (!this.processAttributes(request, context, changes[i])) return false;
+            // this._responseHandler.doAtttributes(childNode);
+            //TODO check the spec if this part is obsolete!!!
+            //} else if (changes[i].tagName == this._PCMD_EXTENSION) {
+            //  this._responseHandler.doExtension(childNode);
+
+            } else {
+                jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML);
+                return false;
+            }
         }
+        return true;
     }
-    return true;
-}
 
-myfaces._impl.xhrCore._AjaxResponse.prototype.processUpdate = function(request, context, node) {
-    if (node.getAttribute('id') == "javax.faces.ViewState") {
-        document.getElementById("javax.faces.ViewState").value = node.firstChild.nodeValue;
+    myfaces._impl.xhrCore._AjaxResponse.prototype.processUpdate = function(request, context, node) {
+        if (node.getAttribute('id') == "javax.faces.ViewState") {
+            document.getElementById("javax.faces.ViewState").value = node.firstChild.nodeValue;
 
         //TODO all forms for elements with the identifier (name?) javax.faces.ViewState
         //if present then set them if the form has no element of type javax.faces.viewState
         //append a hidden field and set it!
-    } else {
-        var cDataBlock = "";
-        // response may contain sevaral blocks
-        for (var i = 0; i < node.childNodes.length; i++) {
-            cDataBlock += node.childNodes[i].data;
-        }
-        if( node.getAttribute('id') == "javax.faces.ViewRoot") {
-
-            var htmlStartEx = /<\s*html[^>]*>/gi;
-            var htmlEndEx = /<\/\s*html[^>]*>/gi;
-            var headStartEx = /<\s*head[^>]*>/gi;
-            var headEndEx = /<\/\s*head[^>]*>/gi;
-            var bodyStartEx = /<\s*body[^>]*>/gi;
-            var bodyEndEx = /<\/\s*body[^>]*>/gi;
-            var htmlStart = htmlStartEx.exec(cDataBlock);
-            if (htmlStart != null) {
-                var htmlEnd = htmlEndEx.exec(cDataBlock);
-                if (htmlEnd != null) {
-                    cDataBlock = cDataBlock.substring(htmlStart.index, htmlEndEx.lastIndex);
-                } else {
-                    cDataBlock = cDataBlock.substring(htmlStart.index);
-                }
+        } else {
+            var cDataBlock = "";
+            // response may contain sevaral blocks
+            for (var i = 0; i < node.childNodes.length; i++) {
+                cDataBlock += node.childNodes[i].data;
             }
-            var headStart = headStartEx.exec(cDataBlock);
-            var newHead = null;
-            if (headStart != null) {
-                var headEnd = headEndEx.exec(cDataBlock);
-                if (headEnd != null) {
-                    newHead = cDataBlock.substring(headStart.index, headEndEx.lastIndex);
-                } else {
-                    newHead = cDataBlock.substring(headStart.index);
+            if( node.getAttribute('id') == "javax.faces.ViewRoot") {
+
+                var htmlStartEx = /<\s*html[^>]*>/gi;
+                var htmlEndEx = /<\/\s*html[^>]*>/gi;
+                var headStartEx = /<\s*head[^>]*>/gi;
+                var headEndEx = /<\/\s*head[^>]*>/gi;
+                var bodyStartEx = /<\s*body[^>]*>/gi;
+                var bodyEndEx = /<\/\s*body[^>]*>/gi;
+                var htmlStart = htmlStartEx.exec(cDataBlock);
+                if (htmlStart != null) {
+                    var htmlEnd = htmlEndEx.exec(cDataBlock);
+                    if (htmlEnd != null) {
+                        cDataBlock = cDataBlock.substring(htmlStart.index, htmlEndEx.lastIndex);
+                    } else {
+                        cDataBlock = cDataBlock.substring(htmlStart.index);
+                    }
                 }
-            }
-            var bodyStart = bodyStartEx.exec(cDataBlock);
-            var newBody = null;
-            if (bodyStart != null) {
-                var bodyEnd = bodyEndEx.exec(cDataBlock);
-                if (bodyEnd != null) {
-                    newBody = cDataBlock.substring(bodyStart.index, bodyEndEx.lastIndex);
-                } else {
-                    newBody = cDataBlock.substring(bodyStart.index);
+                var headStart = headStartEx.exec(cDataBlock);
+                var newHead = null;
+                if (headStart != null) {
+                    var headEnd = headEndEx.exec(cDataBlock);
+                    if (headEnd != null) {
+                        newHead = cDataBlock.substring(headStart.index, headEndEx.lastIndex);
+                    } else {
+                        newHead = cDataBlock.substring(headStart.index);
+                    }
                 }
-            }
-//Werner, I couldn't get this to run. Can you recheck
-//on your 'strippers'? They didn't work for me!
-            //lets strip the internal html if given
-//            var htmlContent = myfaces._impl._util._Utils.getChild.stripHtml(cDataBlock);
-//            htmlContent = (htmlContent == null) ? cDataBlock: htmlContent;
-//            var newHead =  myfaces._impl._util._Utils.getChild.stripHead(htmlContent);
-//            var newBody =  myfaces._impl._util._Utils.getChild.stripBody(htmlContent);
-            var body = document.getElementsByTagName('body')[0];
-            var head = document.getElementsByTagName('head')[0];
-
-            if(newHead != null) {
-                myfaces._impl._util._Utils.replaceHtmlItem(request, context,
-                    head, newHead, this.m_htmlFormElement);
-                //fetch the scripts and do an eval on the scripts to bypass
-                //browser inconsistencies in this area
-                //lets have the browser itself deal with this issue, j4fry
-                //is pretty well optimized in this area!
-                if (myfaces._impl._util._Utils.isUserAgentInternetExplorer()) {
-                    myfaces._impl._util._Utils.runScripts(request, context, head);
+                var bodyStart = bodyStartEx.exec(cDataBlock);
+                var newBody = null;
+                if (bodyStart != null) {
+                    var bodyEnd = bodyEndEx.exec(cDataBlock);
+                    if (bodyEnd != null) {
+                        newBody = cDataBlock.substring(bodyStart.index, bodyEndEx.lastIndex);
+                    } else {
+                        newBody = cDataBlock.substring(bodyStart.index);
+                    }
+                }
+                //Werner, I couldn't get this to run. Can you recheck
+                //on your 'strippers'? They didn't work for me!
+                //lets strip the internal html if given
+                //            var htmlContent = myfaces._impl._util._Utils.getChild.stripHtml(cDataBlock);
+                //            htmlContent = (htmlContent == null) ? cDataBlock: htmlContent;
+                //            var newHead =  myfaces._impl._util._Utils.getChild.stripHead(htmlContent);
+                //            var newBody =  myfaces._impl._util._Utils.getChild.stripBody(htmlContent);
+                var body = document.getElementsByTagName('body')[0];
+                var head = document.getElementsByTagName('head')[0];
+
+                if(newHead != null) {
+                    myfaces._impl._util._Utils.replaceHtmlItem(request, context,
+                        head, newHead, this.m_htmlFormElement);
+                    //fetch the scripts and do an eval on the scripts to bypass
+                    //browser inconsistencies in this area
+                    //lets have the browser itself deal with this issue, j4fry
+                    //is pretty well optimized in this area!
+                    if (myfaces._impl._util._Utils.isUserAgentInternetExplorer()) {
+                        myfaces._impl._util._Utils.runScripts(request, context, head);
+                    }
                 }
-            }
 
-            //if the body content is provided only the body content is applied, according
-            //to the jsDoc specs!
-            if(newBody != null) {
-                myfaces._impl._util._Utils.replaceHtmlItem(request, context,
-                    body, newBody, this.m_htmlFormElement);
-                //TODO fetch the scripts and do an eval on the scripts to bypass
-                //browser inconsistencies in this area
-                if (myfaces._impl._util._Utils.isUserAgentInternetExplorer()) {
+                //if the body content is provided only the body content is applied, according
+                //to the jsDoc specs!
+                if(newBody != null) {
+                    myfaces._impl._util._Utils.replaceHtmlItem(request, context,
+                        body, newBody, this.m_htmlFormElement);
+                    //TODO fetch the scripts and do an eval on the scripts to bypass
+                    //browser inconsistencies in this area
+                    if (myfaces._impl._util._Utils.isUserAgentInternetExplorer()) {
+                        myfaces._impl._util._Utils.runScripts(request, context, body);
+                    }
+                //no body content is defined means we have to replace the body with the entire cdata content
+                } else {
+                    body.innerHTML = cDataBlock;
+                    // innerHTML doesn't execute scripts, so no browser switch here
                     myfaces._impl._util._Utils.runScripts(request, context, body);
                 }
-            //no body content is defined means we have to replace the body with the entire cdata content
             } else {
-                body.innerHTML = cDataBlock;
-                // innerHTML doesn't execute scripts, so no browser switch here
-                myfaces._impl._util._Utils.runScripts(request, context, body);
+                myfaces._impl._util._Utils.replaceHtmlItem(request, context,
+                    node.getAttribute('id'), cDataBlock, this.m_htmlFormElement);
             }
-        } else {
-            myfaces._impl._util._Utils.replaceHtmlItem(request, context,
-                node.getAttribute('id'), cDataBlock, this.m_htmlFormElement);
         }
+        return true;
     }
-    return true;
-}
 
-/*insert, three attributes can be present
- * id = insert id
- * before = before id
- * after = after  id
- *
- * the insert id is the id of the node to be inserted
- * the before is the id if set which the component has to be inserted before
- * the after is the id if set which the component has to be inserted after
- **/
-myfaces._impl.xhrCore._AjaxResponse.prototype.processInsert = function(request, context, node) {
-    var insertId    = node.getAttribute('id');
-    var beforeId    = node.getAttribute('before');
-    var afterId     = node.getAttribute('after');
-
-    var insertSet   = 'undefined' != typeof insertId && null != insertId && myfaces._impl._util._LangUtils.trim(insertId) != "";
-    var beforeSet   = 'undefined' != typeof beforeId && null != beforeId && myfaces._impl._util._LangUtils.trim(beforeId) != "";
-    var afterSet    = 'undefined' != typeof afterId && null != afterId && myfaces._impl._util._LangUtils.trim(afterId) != "";
-
-    if(!insertSet) {
-        jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, "Error in PPR Insert, id must be present");
-        return false;
-    }
-    if(!(beforeSet || afterSet)) {
-        jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, "Error in PPR Insert, before id or after id must be present");
-        return false;
-    }
-    //either before or after but not two at the same time
-     if(beforeSet) {
-        beforeId = myfaces._impl._util._LangUtils.trim(beforeId);
-        var beforeNode = document.getElementById(beforeId);
-        if('undefined' == typeof beforeNode || null == beforeNode) {
-            jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, "Error in PPR Insert, before  node of id "+beforeId+" does not exist in document");
+    /*insert, three attributes can be present
+     * id = insert id
+     * before = before id
+     * after = after  id
+     *
+     * the insert id is the id of the node to be inserted
+     * the before is the id if set which the component has to be inserted before
+     * the after is the id if set which the component has to be inserted after
+     **/
+    myfaces._impl.xhrCore._AjaxResponse.prototype.processInsert = function(request, context, node) {
+        var insertId    = node.getAttribute('id');
+        var beforeId    = node.getAttribute('before');
+        var afterId     = node.getAttribute('after');
+
+        var insertSet   = 'undefined' != typeof insertId && null != insertId && myfaces._impl._util._LangUtils.trim(insertId) != "";
+        var beforeSet   = 'undefined' != typeof beforeId && null != beforeId && myfaces._impl._util._LangUtils.trim(beforeId) != "";
+        var afterSet    = 'undefined' != typeof afterId && null != afterId && myfaces._impl._util._LangUtils.trim(afterId) != "";
+
+        if(!insertSet) {
+            jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, "Error in PPR Insert, id must be present");
             return false;
         }
-        /**
+        if(!(beforeSet || afterSet)) {
+            jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, "Error in PPR Insert, before id or after id must be present");
+            return false;
+        }
+        //either before or after but not two at the same time
+        if(beforeSet) {
+            beforeId = myfaces._impl._util._LangUtils.trim(beforeId);
+            var beforeNode = document.getElementById(beforeId);
+            if('undefined' == typeof beforeNode || null == beforeNode) {
+                jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, "Error in PPR Insert, before  node of id "+beforeId+" does not exist in document");
+                return false;
+            }
+            /**
          *we generate a temp holder
          *so that we can use innerHTML for
          *generating the content upfront
          *before inserting it"
          **/
-        var nodeHolder = document.createElement("div");
-        var parentNode = beforeNode.parentNode;
-        parentNode.insertBefore(nodeHolder, beforeNode);
+            var nodeHolder = document.createElement("div");
+            var parentNode = beforeNode.parentNode;
+            parentNode.insertBefore(nodeHolder, beforeNode);
 
-        myfaces._impl._util._Utils.replaceHtmlItem(request, context,
+            myfaces._impl._util._Utils.replaceHtmlItem(request, context,
                 nodeHolder, node.firstChild.data, null);
 
-    } else {
-        afterId = myfaces._impl._util._LangUtils.trim(afterId);
-        var afterNode = document.getElementById(afterId);
-        if('undefined' == typeof afterNode || null == afterNode) {
-            jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, "Error in PPR Insert, after  node of id "+after+" does not exist in document");
-            return false;
-        }
-        var nodeHolder = document.createElement("div");
-        var parentNode = afterNode.parentNode;
-        parentNode.insertBefore(nodeHolder, afterNode.nextSibling);
-        myfaces._impl._util._Utils.replaceHtmlItem(request, context,
+        } else {
+            afterId = myfaces._impl._util._LangUtils.trim(afterId);
+            var afterNode = document.getElementById(afterId);
+            if('undefined' == typeof afterNode || null == afterNode) {
+                jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML, "Error in PPR Insert, after  node of id "+after+" does not exist in document");
+                return false;
+            }
+            var nodeHolder = document.createElement("div");
+            var parentNode = afterNode.parentNode;
+            parentNode.insertBefore(nodeHolder, afterNode.nextSibling);
+            myfaces._impl._util._Utils.replaceHtmlItem(request, context,
                 nodeHolder, node.firstChild.data, null);
-    }
-    return true;
-}
-
-myfaces._impl.xhrCore._AjaxResponse.prototype.processDelete = function(request, context, node) {
-    var deleteId = node.getAttribute('id');
-    if('undefined' == typeof deleteId || null == deleteId) {
-        jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,
-            myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,  "Error in delete, id not in xml markup");
-        return false;
+        }
+        return true;
     }
 
-    myfaces._impl._util._Utils.deleteItem(request, context, deleteId, "","");
-    return true;
-}
-
-myfaces._impl.xhrCore._AjaxResponse.prototype.processAttributes = function(request, context, node) {
-    //we now route into our attributes function to bypass
-    //IE quirks mode incompatibilities to the biggest possible extent
-    //most browsers just have to do a setAttributes but IE
-    //behaves as usual not like the official standard
-    //myfaces._impl._util._Utils.setAttribute(domNode, attribute, value;
-
-    //<attributes id="id of element"> <attribute name="attribute name" value="attribute value" />* </attributes>
-    var attributesRoot = node;
-    var elementId = attributesRoot.getAttribute('id');
-    if('undefined' == typeof elementId || null == elementId) {
-        jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML
-            ,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,  "Error in attributes, id not in xml markup");
-        return false;
-    }
-    var childs = attributesRoot.childNodes;
+    myfaces._impl.xhrCore._AjaxResponse.prototype.processDelete = function(request, context, node) {
+        var deleteId = node.getAttribute('id');
+        if('undefined' == typeof deleteId || null == deleteId) {
+            jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,
+                myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,  "Error in delete, id not in xml markup");
+            return false;
+        }
 
-    if('undefined' == typeof childs || null == childs) {
-        return false;
+        myfaces._impl._util._Utils.deleteItem(request, context, deleteId, "","");
+        return true;
     }
-    for(var loop2 = 0; loop2 < childs.length; loop2++) {
-        var attributesNode = childs[loop2];
-
-        var attributeName = attributesNode.getAttribute("name");
-        var attributeValue = attributesNode.getAttribute("value");
 
-        if('undefined' == typeof attributeName || null == attributeName) {
-            continue;
+    myfaces._impl.xhrCore._AjaxResponse.prototype.processAttributes = function(request, context, node) {
+        //we now route into our attributes function to bypass
+        //IE quirks mode incompatibilities to the biggest possible extent
+        //most browsers just have to do a setAttributes but IE
+        //behaves as usual not like the official standard
+        //myfaces._impl._util._Utils.setAttribute(domNode, attribute, value;
+
+        //<attributes id="id of element"> <attribute name="attribute name" value="attribute value" />* </attributes>
+        var attributesRoot = node;
+        var elementId = attributesRoot.getAttribute('id');
+        if('undefined' == typeof elementId || null == elementId) {
+            jsf.ajax.sendError(request, context,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML
+                ,myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML,  "Error in attributes, id not in xml markup");
+            return false;
         }
+        var childs = attributesRoot.childNodes;
 
-        attributeName = myfaces._impl._util._LangUtils.trim(attributeName);
-        /*no value means reset*/
-        if('undefined' == typeof attributeValue || null == attributeValue) {
-            attributeValue = "";
+        if('undefined' == typeof childs || null == childs) {
+            return false;
         }
+        for(var loop2 = 0; loop2 < childs.length; loop2++) {
+            var attributesNode = childs[loop2];
+
+            var attributeName = attributesNode.getAttribute("name");
+            var attributeValue = attributesNode.getAttribute("value");
 
-        myfaces._impl._util._Utils.setAttribute(document.getElementById(elementId), attributeName, attributeValue);
+            if('undefined' == typeof attributeName || null == attributeName) {
+                continue;
+            }
+
+            attributeName = myfaces._impl._util._LangUtils.trim(attributeName);
+            /*no value means reset*/
+            if('undefined' == typeof attributeValue || null == attributeValue) {
+                attributeValue = "";
+            }
+
+            myfaces._impl._util._Utils.setAttribute(document.getElementById(elementId), attributeName, attributeValue);
+        }
+        return true;
     }
-    return true;
+
 }
\ No newline at end of file

Modified: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js?rev=767890&r1=767889&r2=767890&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js (original)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js Thu Apr 23 11:04:51 2009
@@ -20,161 +20,163 @@
 
 _reserveMyfacesNamespaces();
 
+if (!myfaces._impl._util._LangUtils.exists(myfaces._impl.xhrCore, "_AjaxUtils")) {
 
-/**
- * Constructor
- * @param {String} alarmThreshold - Error Level
- */
-myfaces._impl.xhrCore._AjaxUtils = function(alarmThreshold) {
-	// Exception Objekt
-	this.alarmThreshold = alarmThreshold;
-	this.m_exception = new myfaces._impl.xhrCore._Exception("myfaces._impl.xhrCore._AjaxUtils", this.alarmThreshold);
-};
-
-/**
- * determines fields to submit
- * @param {HtmlElement} item - item that triggered the event
- * @param {HtmlElement} parentItem - form element item is nested in
- * @param {Array} partialIds - ids fo PPS
- */
-myfaces._impl.xhrCore._AjaxUtils.prototype.processUserEntries = function(request, context, item,
-		parentItem,	partialIds) {
-	try {
-		var form = parentItem;
-
-		if (form == null) {
-			this.m_exception.throwWarning(request, context, "processUserEntries",
-					"Html-Component is not nested in a Form-Tag");
-			return null;
-		}
-
-		var stringBuffer = new Array();
-
-		if (partialIds != null && partialIds.length > 0) {
-			// recursivly check items
-			this.addNodes(form, false, partialIds, stringBuffer);
-		} else {
-			// add all nodes
-			var eLen = form.elements.length;
-			for ( var e = 0; e < eLen; e++) {
-				this.addField(form.elements[e], stringBuffer);
-			} // end of for (formElements)
-		}
-
-		// if triggered by a Button send it along
-		if (item.type != null && item.type.toLowerCase() == "submit") {
-			stringBuffer[stringBuffer.length] = encodeURIComponent(item.name);
-			stringBuffer[stringBuffer.length] = "=";
-			stringBuffer[stringBuffer.length] = encodeURIComponent(item.value);
-			stringBuffer[stringBuffer.length] = "&";
-		}
-
-		return stringBuffer.join("");
-	} catch (e) {
-		alert(e);
-		this.m_exception.throwError(request, context, "processUserEntries", e);
-	}
-};
-
-/**
- * checks recursively if contained in PPS
- * @param {} node - 
- * @param {} insideSubmittedPart -
- * @param {} partialIds -
- * @param {} stringBuffer -
- */
-myfaces._impl.xhrCore._AjaxUtils.prototype.addNodes = function(node, insideSubmittedPart,
-		partialIds, stringBuffer) {
-	if (node != null && node.childNodes != null) {
-		var nLen = node.childNodes.length;
-		for ( var i = 0; i < nLen; i++) {
-			var child = node.childNodes[i];
-			var id = child.id;
-			var elementName = child.name;
-			if (child.nodeType == 1) {
-				var isPartialSubmitContainer = ((id != null) 
-                    && myfaces._impl._util._LangUtils.arrayContains(partialIds, id));
-				if (insideSubmittedPart
-						|| isPartialSubmitContainer
-						|| (elementName != null 
-                        && elementName == myfaces._impl.core._jsfImpl._PROP_VIEWSTATE)) {
-					// node required for PPS
-					this.addField(child, stringBuffer);
-					if (insideSubmittedPart || isPartialSubmitContainer) {
-						// check for further children
-						this.addNodes(child, true, partialIds, stringBuffer);
-					}
-				} else {
-					// check for further children
-					this.addNodes(child, false, partialIds, stringBuffer);
-				}
-			}
-		}
-	}
-}
-
-/**
- * add a single field to stringbuffer for param submission
- * @param {HtmlElement} element - 
- * @param {} stringBuffer - 
- */
-myfaces._impl.xhrCore._AjaxUtils.prototype.addField = function(element, stringBuffer) {
-	var elementName = element.name;
-	var elementTagName = element.tagName.toLowerCase();
-	var elementType = element.type;
-	if (elementType != null) {
-		elementType = elementType.toLowerCase();
-	}
-
-	// routine for all elements
-	// rules:
-	// - process only inputs, textareas and selects
-	// - elements muest have attribute "name"
-	// - elements must not be disabled
-	if (((elementTagName == "input" || elementTagName == "textarea" || elementTagName == "select") && 
-		 (elementName != null && elementName != "")) && element.disabled == false) {
-
-		// routine for select elements
-		// rules:
-		// - if select-one and value-Attribute exist => "name=value"
-		// (also if value empty => "name=")
-		// - if select-one and value-Attribute don't exist =>
-		// "name=DisplayValue"
-		// - if select multi and multple selected => "name=value1&name=value2"
-		// - if select and selectedIndex=-1 don't submit
-		if (elementTagName == "select") {
-			// selectedIndex must be >= 0 sein to be submittet
-			if (element.selectedIndex >= 0) {
-				var uLen = element.options.length;
-				for ( var u = 0; u < uLen; u++) {
-					// find all selected options
-					if (element.options[u].selected == true) {
-						var elementOption = element.options[u];
-						stringBuffer[stringBuffer.length] = encodeURIComponent(elementName);
-						stringBuffer[stringBuffer.length] = "=";
-						if (elementOption.getAttribute("value") != null) {
-							stringBuffer[stringBuffer.length] = encodeURIComponent(elementOption.value);
-						} else {
-							stringBuffer[stringBuffer.length] = encodeURIComponent(elementOption.text);
-						}
-						stringBuffer[stringBuffer.length] = "&";
-					}
-				}
-			}
-		}
-
-		// routine for remaining elements
-		// rules:
-		// - don't submit no selects (processed above), buttons, reset buttons, submit buttons,
-		// - submit checkboxes and radio inputs only if checked
-		if ((elementTagName != "select" && elementType != "button"
-				&& elementType != "reset" && elementType != "submit" && elementType != "image")
-				&& ((elementType != "checkbox" && elementType != "radio") || element.checked)) {
-			stringBuffer[stringBuffer.length] = encodeURIComponent(elementName);
-			stringBuffer[stringBuffer.length] = "=";
-			stringBuffer[stringBuffer.length] = encodeURIComponent(element.value);
-			stringBuffer[stringBuffer.length] = "&";
-		}
-
-	}
-}
+    /**
+     * Constructor
+     * @param {String} alarmThreshold - Error Level
+     */
+    myfaces._impl.xhrCore._AjaxUtils = function(alarmThreshold) {
+        // Exception Objekt
+        this.alarmThreshold = alarmThreshold;
+        this.m_exception = new myfaces._impl.xhrCore._Exception("myfaces._impl.xhrCore._AjaxUtils", this.alarmThreshold);
+    };
+
+    /**
+     * determines fields to submit
+     * @param {HtmlElement} item - item that triggered the event
+     * @param {HtmlElement} parentItem - form element item is nested in
+     * @param {Array} partialIds - ids fo PPS
+     */
+    myfaces._impl.xhrCore._AjaxUtils.prototype.processUserEntries = function(request, context, item,
+        parentItem,	partialIds) {
+        try {
+            var form = parentItem;
+
+            if (form == null) {
+                this.m_exception.throwWarning(request, context, "processUserEntries",
+                    "Html-Component is not nested in a Form-Tag");
+                return null;
+            }
+
+            var stringBuffer = new Array();
+
+            if (partialIds != null && partialIds.length > 0) {
+                // recursivly check items
+                this.addNodes(form, false, partialIds, stringBuffer);
+            } else {
+                // add all nodes
+                var eLen = form.elements.length;
+                for ( var e = 0; e < eLen; e++) {
+                    this.addField(form.elements[e], stringBuffer);
+                } // end of for (formElements)
+            }
+
+            // if triggered by a Button send it along
+            if (item.type != null && item.type.toLowerCase() == "submit") {
+                stringBuffer[stringBuffer.length] = encodeURIComponent(item.name);
+                stringBuffer[stringBuffer.length] = "=";
+                stringBuffer[stringBuffer.length] = encodeURIComponent(item.value);
+                stringBuffer[stringBuffer.length] = "&";
+            }
+
+            return stringBuffer.join("");
+        } catch (e) {
+            alert(e);
+            this.m_exception.throwError(request, context, "processUserEntries", e);
+        }
+    };
+
+    /**
+     * checks recursively if contained in PPS
+     * @param {} node -
+     * @param {} insideSubmittedPart -
+     * @param {} partialIds -
+     * @param {} stringBuffer -
+     */
+    myfaces._impl.xhrCore._AjaxUtils.prototype.addNodes = function(node, insideSubmittedPart,
+        partialIds, stringBuffer) {
+        if (node != null && node.childNodes != null) {
+            var nLen = node.childNodes.length;
+            for ( var i = 0; i < nLen; i++) {
+                var child = node.childNodes[i];
+                var id = child.id;
+                var elementName = child.name;
+                if (child.nodeType == 1) {
+                    var isPartialSubmitContainer = ((id != null)
+                        && myfaces._impl._util._LangUtils.arrayContains(partialIds, id));
+                    if (insideSubmittedPart
+                        || isPartialSubmitContainer
+                        || (elementName != null
+                            && elementName == myfaces._impl.core._jsfImpl._PROP_VIEWSTATE)) {
+                        // node required for PPS
+                        this.addField(child, stringBuffer);
+                        if (insideSubmittedPart || isPartialSubmitContainer) {
+                            // check for further children
+                            this.addNodes(child, true, partialIds, stringBuffer);
+                        }
+                    } else {
+                        // check for further children
+                        this.addNodes(child, false, partialIds, stringBuffer);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * add a single field to stringbuffer for param submission
+     * @param {HtmlElement} element -
+     * @param {} stringBuffer -
+     */
+    myfaces._impl.xhrCore._AjaxUtils.prototype.addField = function(element, stringBuffer) {
+        var elementName = element.name;
+        var elementTagName = element.tagName.toLowerCase();
+        var elementType = element.type;
+        if (elementType != null) {
+            elementType = elementType.toLowerCase();
+        }
+
+        // routine for all elements
+        // rules:
+        // - process only inputs, textareas and selects
+        // - elements muest have attribute "name"
+        // - elements must not be disabled
+        if (((elementTagName == "input" || elementTagName == "textarea" || elementTagName == "select") &&
+            (elementName != null && elementName != "")) && element.disabled == false) {
+
+            // routine for select elements
+            // rules:
+            // - if select-one and value-Attribute exist => "name=value"
+            // (also if value empty => "name=")
+            // - if select-one and value-Attribute don't exist =>
+            // "name=DisplayValue"
+            // - if select multi and multple selected => "name=value1&name=value2"
+            // - if select and selectedIndex=-1 don't submit
+            if (elementTagName == "select") {
+                // selectedIndex must be >= 0 sein to be submittet
+                if (element.selectedIndex >= 0) {
+                    var uLen = element.options.length;
+                    for ( var u = 0; u < uLen; u++) {
+                        // find all selected options
+                        if (element.options[u].selected == true) {
+                            var elementOption = element.options[u];
+                            stringBuffer[stringBuffer.length] = encodeURIComponent(elementName);
+                            stringBuffer[stringBuffer.length] = "=";
+                            if (elementOption.getAttribute("value") != null) {
+                                stringBuffer[stringBuffer.length] = encodeURIComponent(elementOption.value);
+                            } else {
+                                stringBuffer[stringBuffer.length] = encodeURIComponent(elementOption.text);
+                            }
+                            stringBuffer[stringBuffer.length] = "&";
+                        }
+                    }
+                }
+            }
+
+            // routine for remaining elements
+            // rules:
+            // - don't submit no selects (processed above), buttons, reset buttons, submit buttons,
+            // - submit checkboxes and radio inputs only if checked
+            if ((elementTagName != "select" && elementType != "button"
+                && elementType != "reset" && elementType != "submit" && elementType != "image")
+            && ((elementType != "checkbox" && elementType != "radio") || element.checked)) {
+                stringBuffer[stringBuffer.length] = encodeURIComponent(elementName);
+                stringBuffer[stringBuffer.length] = "=";
+                stringBuffer[stringBuffer.length] = encodeURIComponent(element.value);
+                stringBuffer[stringBuffer.length] = "&";
+            }
+
+        }
+    }
+}
\ No newline at end of file

Modified: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Exception.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Exception.js?rev=767890&r1=767889&r2=767890&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Exception.js (original)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Exception.js Thu Apr 23 11:04:51 2009
@@ -21,66 +21,71 @@
 _reserveMyfacesNamespaces();
 
 
-myfaces._impl.xhrCore._Exception = function(sourceClass, threshold) {
-	this.m_class = sourceClass
-	this.m_threshold = threshold
-};
+if (!myfaces._impl._util._LangUtils.exists(myfaces._impl.xhrCore, "_Exception")) {
 
-/**
+
+    myfaces._impl.xhrCore._Exception = function(sourceClass, threshold) {
+        this.m_class = sourceClass
+        this.m_threshold = threshold
+    };
+
+    /**
  * [STATIC]
  * static method used by static methods that throw errors
  */
-myfaces._impl.xhrCore._Exception.throwNewError = function(request, context, sourceClass, func, exception) {
-	newException = new myfaces._impl.xhrCore._Exception(request, context, sourceClass, "ERROR");
-	newException.throwError(request, context, func, exception);
-};
+    myfaces._impl.xhrCore._Exception.throwNewError = function(request, context, sourceClass, func, exception) {
+        newException = new myfaces._impl.xhrCore._Exception(request, context, sourceClass, "ERROR");
+        newException.throwError(request, context, func, exception);
+    };
 
-/**
+    /**
  * [STATIC]
  * static method used by static methods that throw warnings
  */
-myfaces._impl.xhrCore._Exception.throwNewWarning = function(request, context, sourceClass, func, message){
-	newException = new myfaces._impl.xhrCore._Exception(request, context, sourceClass, "WARNING");
-	newException.throwWarning(request, context, func, message);
-};
+    myfaces._impl.xhrCore._Exception.throwNewWarning = function(request, context, sourceClass, func, message){
+        newException = new myfaces._impl.xhrCore._Exception(request, context, sourceClass, "WARNING");
+        newException.throwWarning(request, context, func, message);
+    };
 
-/**
+    /**
  * throws errors
  */
-myfaces._impl.xhrCore._Exception.prototype.throwError = function(request, context, func, exception) {
-	if (this.m_threshold == "ERROR") {
-		jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_CLIENT_ERROR, exception.name,
+    myfaces._impl.xhrCore._Exception.prototype.throwError = function(request, context, func, exception) {
+        if (this.m_threshold == "ERROR") {
+            jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_CLIENT_ERROR, exception.name,
                 "MyFaces ERROR\n"
-				+ "Affected Class: " + this.m_class + "\n"
-				+ "Affected Method: " + func + "\n"
-				+ "Error name: " + exception.name + "\n"
-				+ "Error message: " + exception.message + "\n"
-				+ "Error description: " + exception.description	+ "\n"
-				+ "Error number: " + exception.number + "\n"
-				+ "Error line number: " + exception.lineNumber);
-	}
-	this.destroy();
-};
+                + "Affected Class: " + this.m_class + "\n"
+                + "Affected Method: " + func + "\n"
+                + "Error name: " + exception.name + "\n"
+                + "Error message: " + exception.message + "\n"
+                + "Error description: " + exception.description	+ "\n"
+                + "Error number: " + exception.number + "\n"
+                + "Error line number: " + exception.lineNumber);
+        }
+        this.destroy();
+    };
 
-/**
+    /**
  * throws warnings
  */
-myfaces._impl.xhrCore._Exception.prototype.throwWarning = function(request, context, func, message) {
-	if (this.m_threshold == "WARNING" || this.m_threshold == "ERROR") {
-		jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_CLIENT_ERROR, exception.name,
-            "MyFaces WARNING\n[" + this.m_class + "::" + func + "]\n\n"
-				+ message);
-	}
-	this.destroy();
-};
+    myfaces._impl.xhrCore._Exception.prototype.throwWarning = function(request, context, func, message) {
+        if (this.m_threshold == "WARNING" || this.m_threshold == "ERROR") {
+            jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_CLIENT_ERROR, exception.name,
+                "MyFaces WARNING\n[" + this.m_class + "::" + func + "]\n\n"
+                + message);
+        }
+        this.destroy();
+    };
 
-/**
+    /**
  * cleanup activities if an error occurs
  */
-myfaces._impl.xhrCore._Exception.prototype.destroy = function() {
-	if (myfaces._impl.xhrCore._AjaxRequestQueue.queue &&
-			myfaces._impl.xhrCore._AjaxRequestQueue.queue != null) {
-		// clear RequestQueue when an exception occurs
-		myfaces._impl.xhrCore._AjaxRequestQueue.queue.clearQueue();
-	}
-};
\ No newline at end of file
+    myfaces._impl.xhrCore._Exception.prototype.destroy = function() {
+        if (myfaces._impl.xhrCore._AjaxRequestQueue.queue &&
+            myfaces._impl.xhrCore._AjaxRequestQueue.queue != null) {
+            // clear RequestQueue when an exception occurs
+            myfaces._impl.xhrCore._AjaxRequestQueue.queue.clearQueue();
+        }
+    };
+
+}
\ No newline at end of file

Modified: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_xhrCoreAdapter.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_xhrCoreAdapter.js?rev=767890&r1=767889&r2=767890&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_xhrCoreAdapter.js (original)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_xhrCoreAdapter.js Thu Apr 23 11:04:51 2009
@@ -20,41 +20,46 @@
 
 _reserveMyfacesNamespaces();
 
-/**
- * Constructor
- */
-myfaces._impl.xhrCore._Ajax = function() {}
-
-/**
- * Spec. 13.3.1
- * Collect and encode input elements.
- * Additinoaly the hidden element javax.faces.ViewState
- * @param {String} FORM_ELEMENT - Client-Id of Form-Element
- * @return {String} - Concatenated String of the encoded input elements
- * 			and javax.faces.ViewState element
- */
-myfaces._impl.xhrCore._Ajax.prototype.getViewState = function(FORM_ELEMENT) {
-    return myfaces._impl.xhrCore._AjaxRequestQueue.queue.m_request.getViewState();
-}
-
-
-/**
- * mapped options already have the exec and view properly in place
- * myfaces specifics can be found under mappedOptions.myFaces
- * @param ajaxContext the ajax context which also has to be pushed into the messages and into the response
- **/
-
-myfaces._impl.xhrCore._Ajax.prototype._ajaxRequest = function(source, sourceForm, context, passThroughValues ) {
-   	myfaces._impl.xhrCore._AjaxRequestQueue.queue.queueRequest(
-        new myfaces._impl.xhrCore._AjaxRequest(source, sourceForm, context, passThroughValues));
-}
-
-/**
- * Spec. 13.3.3
- * Examining the response markup and updating the DOM tree
- * @param {XmlHttpRequest} request - the ajax request
- * @param {XmlHttpRequest} context - the ajax context
- */
-myfaces._impl.xhrCore._Ajax.prototype._ajaxResponse = function(request, context) {
-	myfaces._impl.xhrCore._AjaxRequestQueue.queue.m_request.m_response.processResponse(request, context);
-}
+if (!myfaces._impl._util._LangUtils.exists(myfaces._impl.xhrCore, "_Ajax")) {
+
+
+    /**
+     * Constructor
+     */
+    myfaces._impl.xhrCore._Ajax = function() {}
+
+    /**
+     * Spec. 13.3.1
+     * Collect and encode input elements.
+     * Additinoaly the hidden element javax.faces.ViewState
+     * @param {String} FORM_ELEMENT - Client-Id of Form-Element
+     * @return {String} - Concatenated String of the encoded input elements
+     * 			and javax.faces.ViewState element
+     */
+    myfaces._impl.xhrCore._Ajax.prototype.getViewState = function(FORM_ELEMENT) {
+        return myfaces._impl.xhrCore._AjaxRequestQueue.queue.m_request.getViewState();
+    }
+
+
+    /**
+     * mapped options already have the exec and view properly in place
+     * myfaces specifics can be found under mappedOptions.myFaces
+     * @param ajaxContext the ajax context which also has to be pushed into the messages and into the response
+     **/
+
+    myfaces._impl.xhrCore._Ajax.prototype._ajaxRequest = function(source, sourceForm, context, passThroughValues ) {
+        myfaces._impl.xhrCore._AjaxRequestQueue.queue.queueRequest(
+            new myfaces._impl.xhrCore._AjaxRequest(source, sourceForm, context, passThroughValues));
+    }
+
+    /**
+     * Spec. 13.3.3
+     * Examining the response markup and updating the DOM tree
+     * @param {XmlHttpRequest} request - the ajax request
+     * @param {XmlHttpRequest} context - the ajax context
+     */
+    myfaces._impl.xhrCore._Ajax.prototype._ajaxResponse = function(request, context) {
+        myfaces._impl.xhrCore._AjaxRequestQueue.queue.m_request.m_response.processResponse(request, context);
+    }
+
+}
\ No newline at end of file

Modified: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js?rev=767890&r1=767889&r2=767890&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js (original)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js Thu Apr 23 11:04:51 2009
@@ -72,11 +72,11 @@
      *  <li> all requests must be queued with a client side request queue to ensure the request ordering!</li>
      * </ul>
      *
-     * @param element: any dom element no matter being it html or jsf, from which the event is emitted
-     * @param event: any javascript event supported by that object
-     * @param options : map of options being pushed into the ajax cycle
+     * @param {String|Node} element: 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 {Map||} options : map of options being pushed into the ajax cycle
      */
-    jsf.ajax.request = function(/*String|Dom Node*/ element, /*|EVENT|*/ event, /*{|OPTIONS|}*/ options) {
+    jsf.ajax.request = function( element,  event,  options) {
         return jsf.ajax._impl.request(element, event, options);
     };