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/07/01 17:42:29 UTC

svn commit: r790222 - in /myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl: _util/_HtmlStripper.js _util/_Utils.js core/jsf_impl.js xhrCore/_AjaxRequest.js xhrCore/_AjaxResponse.js xhrCore/_Exception.js

Author: werpu
Date: Wed Jul  1 15:42:29 2009
New Revision: 790222

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

improved compatibility to the ri by exposing exceptions within the client
area to the browser, fixed finally the atttributes code so that it works over all current ie platforms in a cross browser fashion (including ie8 compat and quirks mode)


Modified:
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_HtmlStripper.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf_impl.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js
    myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Exception.js

Modified: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_HtmlStripper.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_HtmlStripper.js?rev=790222&r1=790221&r2=790222&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_HtmlStripper.js (original)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_HtmlStripper.js Wed Jul  1 15:42:29 2009
@@ -76,6 +76,9 @@
         this.tokens = theString.split("");
         this.tagAttributes = {};
 
+        this._tagStart = -1;
+        this._tagEnd = -1;
+
         this._contentStart = -1;
         this._contentEnd = -1;
         this._tokenPos = 0;
@@ -116,6 +119,34 @@
     };
 
     /**
+     * fetches the content block which has been parsed
+     */
+    myfaces._impl._util._HtmlStripper.prototype.getContentBlock = function() {
+        return this.tokens.slice(this._contentStart, this._contentEnd + 1).join("");
+    },
+
+    /**
+     * fetches the content tag block including the tag code
+     */
+    myfaces._impl._util._HtmlStripper.prototype.getContentTagBlock = function() {
+        return this.tokens.slice(this._tagStart, this._tagEnd + 1).join("");
+    },
+
+    /**
+     * fetches the block before the tag begin
+     */
+    myfaces._impl._util._HtmlStripper.prototype.getPreTagBlock = function() {
+        return this.tokens.slice(0, this._tagStart).join("");
+    },
+
+    /**
+     * fetches the block after the tag end
+     */
+    myfaces._impl._util._HtmlStripper.prototype.getPostTagBlock = function() {
+        return this.tokens.slice(this._tagEnd, this.tokens.length).join("");
+    },
+
+    /**
      * normal characters are skipped
      * a < clearly is an indicator for
      * a ... normal chars should not occur here, but
@@ -137,6 +168,7 @@
      */
     myfaces._impl._util._HtmlStripper.prototype.handleDocument = function() {
 
+        this._tagStart = this.tokenPos;
         this._skipBlank(1);
 
         if (this._tokenPos >= this.tokens.length) {
@@ -332,7 +364,7 @@
     };
 
     myfaces._impl._util._HtmlStripper.prototype.handleEndTagPart = function() {
-
+        this._tagEnd = this._tokenPos;
         this._skipBlank(1);
 
         if (this._tokenPos < 0) {

Modified: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js?rev=790222&r1=790221&r2=790222&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js (original)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js Wed Jul  1 15:42:29 2009
@@ -20,14 +20,12 @@
 
 _reserveMyfacesNamespaces();
 
-if(!myfaces._impl._util._LangUtils.exists(myfaces._impl._util,"_Utils")) {
+if (!myfaces._impl._util._LangUtils.exists(myfaces._impl._util, "_Utils")) {
     /**
      * Constructor
      */
     myfaces._impl._util._Utils = function() {
-
-        }
-
+    }
 
     myfaces._impl._util._Utils.browserDetection = function() {
         /**
@@ -44,16 +42,16 @@
          */
         var n = navigator;
         var dua = n.userAgent,
-        dav = n.appVersion,
-        tv = parseFloat(dav);
+                dav = n.appVersion,
+                tv = parseFloat(dav);
 
         myfaces._impl._util._Utils.browser = {};
         var d = myfaces._impl._util._Utils.browser;
 
-        if(dua.indexOf("Opera") >= 0){
+        if (dua.indexOf("Opera") >= 0) {
             myfaces._impl._util._Utils.isOpera = tv;
         }
-        if(dua.indexOf("AdobeAIR") >= 0){
+        if (dua.indexOf("AdobeAIR") >= 0) {
             d.isAIR = 1;
         }
         d.isKhtml = (dav.indexOf("Konqueror") >= 0) ? tv : 0;
@@ -64,37 +62,36 @@
         //		http://developer.apple.com/internet/safari/faq.html#anchor2
         //		http://developer.apple.com/internet/safari/uamatrix.html
         var index = Math.max(dav.indexOf("WebKit"), dav.indexOf("Safari"), 0);
-        if(index && !d.isChrome){
+        if (index && !d.isChrome) {
             // try to grab the explicit Safari version first. If we don't get
             // one, look for less than 419.3 as the indication that we're on something
             // "Safari 2-ish".
             d.isSafari = parseFloat(dav.split("Version/")[1]);
-            if(!d.isSafari || parseFloat(dav.substr(index + 7)) <= 419.3){
+            if (!d.isSafari || parseFloat(dav.substr(index + 7)) <= 419.3) {
                 d.isSafari = 2;
             }
         }
 
         //>>excludeStart("webkitMobile", kwArgs.webkitMobile);
-        if(dua.indexOf("Gecko") >= 0 && !d.isKhtml && !d.isWebKit){
+        if (dua.indexOf("Gecko") >= 0 && !d.isKhtml && !d.isWebKit) {
             d.isMozilla = d.isMoz = tv;
         }
-        if(d.isMoz){
+        if (d.isMoz) {
             //We really need to get away from this. Consider a sane isGecko approach for the future.
             d.isFF = parseFloat(dua.split("Firefox/")[1] || dua.split("Minefield/")[1] || dua.split("Shiretoko/")[1]) || undefined;
         }
-        if(document.all && !d.isOpera){
+        if (document.all && !d.isOpera) {
             d.isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;
             //In cases where the page has an HTTP header or META tag with
             //X-UA-Compatible, then it is in emulation mode, for a previous
             //version. Make sure isIE reflects the desired version.
             //document.documentMode of 5 means quirks mode.
-            if(d.isIE >= 8 && document.documentMode != 5){
+            if (d.isIE >= 8 && document.documentMode != 5) {
                 d.isIE = document.documentMode;
             }
         }
     };
 
-
     /**
      * encapsulated xhr object which tracks down various implementations
      * of the xhr object in a browser independend fashion
@@ -103,14 +100,14 @@
      * newer ie versions adhere to the standard and all other new browsers do anyway)
      */
     myfaces._impl._util._Utils.getXHRObject = function() {
-        if('undefined' != typeof XMLHttpRequest && null != XMLHttpRequest) {
+        if ('undefined' != typeof XMLHttpRequest && null != XMLHttpRequest) {
             return new XMLHttpRequest();
         }
         //IE
         try {
             return new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
-            
+
         }
         return new ActiveXObject('Microsoft.XMLHTTP');
     }
@@ -126,31 +123,31 @@
         var xhr = myfaces._impl._util._Utils.getXHRObject();
         xhr.open("GET", src, false);
 
-        if('undefined' != typeof charSet && null != charSet) {
-            xhr.setRequestHeader("Content-Type","application/x-javascript; charset:"+charSet);
+        if ('undefined' != typeof charSet && null != charSet) {
+            xhr.setRequestHeader("Content-Type", "application/x-javascript; charset:" + charSet);
         }
 
         xhr.send(null);
 
         //since we are synchronous we do it after not with onReadyStateChange
-        if(xhr.readyState == 4) {
+        if (xhr.readyState == 4) {
             if (xhr.status == 200) {
                 //defer also means we have to process after the ajax response
                 //has been processed
                 //we can achieve that with a small timeout, the timeout
                 //triggers after the processing is done!
-                if(!defer) {
+                if (!defer) {
                     myfaces._impl._util._Utils.globalEval(xhr.responseText);
                 } else {
-                   setTimeout(function() {
-                     myfaces._impl._util._Utils.globalEval(xhr.responseText);
-                   },1);
+                    setTimeout(function() {
+                        myfaces._impl._util._Utils.globalEval(xhr.responseText);
+                    }, 1);
                 }
             } else {
                 throw Error(xhr.responseText);
             }
         } else {
-            throw Error("Loading of script "+src+" failed ");
+            throw Error("Loading of script " + src + " failed ");
         }
     }
 
@@ -166,33 +163,33 @@
         if (item.nodeType == 1) { // only if it's an element node
             if (item.tagName.toLowerCase() == 'script') {
                 try {
-	            	if (typeof item.getAttribute('src') != 'undefined' 
-	                	&& item.getAttribute('src') != null
-	                	&& item.getAttribute('src').length > 0 ) {
-	            		// external script auto eval
-	            		myfaces._impl._util._Utils.loadScript(item.getAttribute('src'), item.getAttribute('type'), false, "ISO-8859-1");
-	            	} else {
-	            		// embedded script auto eval
-	                    var test = item.text;
-	                    var go = true;
-	                    while (go) {
-	                        go = false;
-	                        if (test.substring(0, 1) == " ") {
-	                            test = test.substring(1);
-	                            go = true;
-	                        }
-	                        if (test.substring(0, 4) == "<!--") {
-	                            test = test.substring(4);
-	                            go = true;
-	                        }
-	                        if (test.substring(0, 11) == "//<![CDATA[") {
-	                            test = test.substring(11);
-	                            go = true;
-	                        }
-	                    }
-	                    // we have to run the script under a global context
-	                    myfaces._impl._util._Utils.globalEval(test); // run the script
-	            	}
+                    if (typeof item.getAttribute('src') != 'undefined'
+                            && item.getAttribute('src') != null
+                            && item.getAttribute('src').length > 0) {
+                        // external script auto eval
+                        myfaces._impl._util._Utils.loadScript(item.getAttribute('src'), item.getAttribute('type'), false, "ISO-8859-1");
+                    } else {
+                        // embedded script auto eval
+                        var test = item.text;
+                        var go = true;
+                        while (go) {
+                            go = false;
+                            if (test.substring(0, 1) == " ") {
+                                test = test.substring(1);
+                                go = true;
+                            }
+                            if (test.substring(0, 4) == "<!--") {
+                                test = test.substring(4);
+                                go = true;
+                            }
+                            if (test.substring(0, 11) == "//<![CDATA[") {
+                                test = test.substring(11);
+                                go = true;
+                            }
+                        }
+                        // we have to run the script under a global context
+                        myfaces._impl._util._Utils.globalEval(test); // run the script
+                    }
                 } catch (e) {
                     myfaces._impl.xhrCore._Exception.throwNewError(request, context, "Utils", "runScripts", e);
                 }
@@ -213,7 +210,7 @@
         var item = document.getElementById(itemIdToReplace);
         if (item == null) {
             myfaces._impl.xhrCore._Exception.throwNewWarning
-            (request, context, "Utils", "deleteItem", "Unknown Html-Component-ID: " + itemIdToReplace);
+                    (request, context, "Utils", "deleteItem", "Unknown Html-Component-ID: " + itemIdToReplace);
             return;
         }
 
@@ -233,19 +230,19 @@
         try {
             //for webkit we have to trim otherwise he does not add the adjancent elements correctly
             newTag = myfaces._impl._util._LangUtils.trim(newTag);
-        	// (itemIdToReplace instanceof Node) is NOT compatible with IE8
+            // (itemIdToReplace instanceof Node) is NOT compatible with IE8
             var item = (typeof itemIdToReplace == "object") ? itemIdToReplace :
-            myfaces._impl._util._Utils.getElementFromForm(request, context, itemIdToReplace, form);
+                       myfaces._impl._util._Utils.getElementFromForm(request, context, itemIdToReplace, form);
 
             if (item == null) {
                 myfaces._impl.xhrCore._Exception.throwNewWarning
-                (request, context, "Utils", "replaceHTMLItem", "Unknown Html-Component-ID: " + itemIdToReplace);
+                        (request, context, "Utils", "replaceHTMLItem", "Unknown Html-Component-ID: " + itemIdToReplace);
                 return;
             }
 
             if (newTag != "") {
                 if (typeof window.Range != 'undefined'
-                    && typeof Range.prototype.createContextualFragment == 'function' ) {
+                        && typeof Range.prototype.createContextualFragment == 'function') {
                     var range = document.createRange();
                     range.setStartBefore(item);
                     var fragment = range.createContextualFragment(newTag);
@@ -253,15 +250,15 @@
                 } else {
                     item.insertAdjacentHTML('beforeBegin', newTag);
                 }
-                if(myfaces._impl._util._Utils.isManualScriptEval()) {
+                if (myfaces._impl._util._Utils.isManualScriptEval()) {
                     myfaces._impl._util._Utils.runScripts(request, context, item.previousSibling);
                 }
             }
             // and remove the old item
             item.parentNode.removeChild(item);
-            
+
         } catch (e) {
-            myfaces._impl.xhrCore._Exception.throwNewError (request, context, "Utils", "replaceHTMLItem", e);
+            myfaces._impl.xhrCore._Exception.throwNewError(request, context, "Utils", "replaceHTMLItem", e);
         }
     };
 
@@ -292,13 +289,15 @@
      */
     myfaces._impl._util._Utils.setAttribute = function(domNode, attribute, value) {
 
-        if(!myfaces._impl._util._Utils.isUserAgentInternetExplorer()) {
-            domNode.setAttribute(attribute,value);
+        //quirks mode and ie7 mode has the attributes problems ie8 standards mode behaves like
+        //a good citizen
+        if (!myfaces._impl._util._Utils.isUserAgentInternetExplorer() || myfaces._impl._util._Utils.browser.isIE > 7) {
+
+            domNode.setAttribute(attribute, value);
             return;
         }
-        //Now to the broken browsers IE6+.... ie7 and ie8 quirks mode
-
 
+        //Now to the broken browsers IE6+.... ie7 and ie8 quirks mode
         //now ie has the behavior of not wanting events to be set directly and also
         //class must be renamed to classname
         //according to http://www.quirksmode.org/dom/w3c_core.html it does not set styles
@@ -309,30 +308,37 @@
         //1. remap the class
         attribute = attribute.toLowerCase();
 
-        if(attribute === "class") {
-            domNode["className"] = value;
-        } else if(attribute === style) {
+        if (attribute === "class") {
+            domNode.setAttribute("className", value);
+        } else if (attribute === "for") {
+            //http://delete.me.uk/2004/09/ieproto.html
+            domNode.setAttribute("htmlFor", value);
+        } else if (attribute === "style") {
+
             //We have to split the styles here and assign them one by one
             var styleEntries = value.split(";");
-            for(var loop = 0; loop < styleEntries.length; loop++) {
+            for (var loop = 0; loop < styleEntries.length; loop++) {
                 var keyVal = styleEntries[loop].split(":");
-                domNode["style"][keyVal[0]] = keyVal[1];
+                if (keyVal[0] != "") {
+                    domNode.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(myfaces._impl._util._Utils.ieQuircksEvents[attribute]) {
-                if(myfaces._impl._util._LangUtils.isString(attribute)) {
-                    domNode[attribute] = function(event) {
-                        //TODO check the scope of this handler
+            if (myfaces._impl._util._Utils.ieQuircksEvents[attribute]) {
+                if (myfaces._impl._util._LangUtils.isString(attribute)) {
+                    domNode.setAttribute(attribute, function(event) {
                         myfaces._impl._util._Utils.globalEval(attribute);
-                    };
+                    });
                 }
+            } else {
+                //unknown cases we try to catch them via standard setAttributes
+                domNode.setAttribute(attribute, value);
             }
-            domNode[attribute] = value;
         }
-    //TODO this needs further testing I will leave it for now...
     };
 
     /**
@@ -347,25 +353,24 @@
         //TODO test this with various browsers so that we have auto eval wherever possible
         //
         //tested currently safari, ie, firefox, opera
-        var retVal = (_LangUtils.exists(myfaces._impl._util._Utils.browser,"isIE") &&
-            ( myfaces._impl._util._Utils.browser.isIE > 5.5))||
-        (_LangUtils.exists(myfaces._impl._util._Utils.browser,"isKhtml") &&
-            (myfaces._impl._util._Utils.browser.isKhtml > 0))   ||
-        (_LangUtils.exists(myfaces._impl._util._Utils.browser,"isWebKit") &&
-            (myfaces._impl._util._Utils.browser.isWebKit > 0)) ||
-         (_LangUtils.exists(myfaces._impl._util._Utils.browser,"isSafari") &&
-            (myfaces._impl._util._Utils.browser.isSafari > 0));
-      
+        var retVal = (_LangUtils.exists(myfaces._impl._util._Utils.browser, "isIE") &&
+                      ( myfaces._impl._util._Utils.browser.isIE > 5.5)) ||
+                     (_LangUtils.exists(myfaces._impl._util._Utils.browser, "isKhtml") &&
+                      (myfaces._impl._util._Utils.browser.isKhtml > 0)) ||
+                     (_LangUtils.exists(myfaces._impl._util._Utils.browser, "isWebKit") &&
+                      (myfaces._impl._util._Utils.browser.isWebKit > 0)) ||
+                     (_LangUtils.exists(myfaces._impl._util._Utils.browser, "isSafari") &&
+                      (myfaces._impl._util._Utils.browser.isSafari > 0));
+
         return retVal;
-               
-    //another way to determine this without direct user agent parsing probably could
-    //be to add an embedded script tag programmatically and check for the script variable
-    //set by the script if existing, the add went through an eval if not then we
-    //have to deal with it outselves, this might be dangerous in case of the ie however
-    //so in case of ie we have to parse for all other browsers we can make a dynamic
-    //check if the browser does auto eval
-    //TODO discuss those things
-       
+
+        //another way to determine this without direct user agent parsing probably could
+        //be to add an embedded script tag programmatically and check for the script variable
+        //set by the script if existing, the add went through an eval if not then we
+        //have to deal with it outselves, this might be dangerous in case of the ie however
+        //so in case of ie we have to parse for all other browsers we can make a dynamic
+        //check if the browser does auto eval
+        //TODO discuss those things
     };
 
     /**
@@ -395,25 +400,24 @@
     myfaces._impl._util._Utils.getElementFromForm = function(request, context, itemIdOrName, form, nameSearch, localSearchOnly) {
         try {
 
-            if('undefined' == typeof form || form == null) {
+            if ('undefined' == typeof form || form == null) {
                 return document.getElementById(itemIdOrName);
             }
-            if('undefined' == typeof includeName || nameSearch == null) {
+            if ('undefined' == typeof includeName || nameSearch == null) {
                 nameSearch = false;
             }
-            if('undefined' == typeof localSearchOnly || localSearchOnly == null) {
+            if ('undefined' == typeof localSearchOnly || localSearchOnly == null) {
                 localSearchOnly = false;
             }
 
-
             var fLen = form.elements.length;
-            
+
             //we first check for a name entry!
-            if(nameSearch && 'undefined' != typeof form.elements[itemIdOrName] && null != form.elements[itemIdOrName]) {
+            if (nameSearch && 'undefined' != typeof form.elements[itemIdOrName] && null != form.elements[itemIdOrName]) {
                 return form.elements[itemIdOrName];
             }
             //if no name entry is found we check for an Id
-            for ( var f = 0; f < fLen; f++) {
+            for (var f = 0; f < fLen; f++) {
                 var element = form.elements[f];
                 if (element.id != null && element.id == itemIdOrName) {
                     return element;
@@ -421,7 +425,7 @@
             }
             // element not found inside the form -> try document.getElementById
             // (kann be null if element doesn't exist)
-            if(!localSearchOnly) {
+            if (!localSearchOnly) {
                 return document.getElementById(itemIdOrName);
             }
         } catch (e) {
@@ -430,8 +434,6 @@
         return null;
     };
 
-
-
     /**
      * [STATIC]
      * gets a parent of an item with a given tagname
@@ -445,18 +447,18 @@
             // parent tag parentName suchen
             var parentItem = item.parentNode;
             while (parentItem != null
-                && parentItem.tagName.toLowerCase() != parentName) {
+                    && parentItem.tagName.toLowerCase() != parentName) {
                 parentItem = parentItem.parentNode;
             }
             if (parentItem != null) {
                 return parentItem;
             } else {
                 myfaces._impl.xhrCore._Exception.throwNewWarning
-                (request, context, "Utils", "getParent", "The item has no parent with type <" + parentName + ">");
+                        (request, context, "Utils", "getParent", "The item has no parent with type <" + parentName + ">");
                 return null;
             }
         } catch (e) {
-            myfaces._impl.xhrCore._Exception.throwNewError (request, context, "Utils", "getParent", e);
+            myfaces._impl.xhrCore._Exception.throwNewError(request, context, "Utils", "getParent", e);
         }
     };
 
@@ -469,10 +471,10 @@
      */
     myfaces._impl._util._Utils.getChild = function(item, childName, itemName) {
         var childItems = item.childNodes;
-        for ( var c = 0, cLen = childItems.length; c < cLen; c++) {
+        for (var c = 0, cLen = childItems.length; c < cLen; c++) {
             if (childItems[c].tagName != null
-                && childItems[c].tagName.toLowerCase() == childName
-                && (itemName == null || (itemName != null && itemName == childItems[c]
+                    && childItems[c].tagName.toLowerCase() == childName
+                    && (itemName == null || (itemName != null && itemName == childItems[c]
                     .getAttribute("name")))) {
                 return childItems[c];
             }
@@ -480,10 +482,6 @@
         return null;
     }
 
-
-  
-
-
     /**
      * fetches a global config entry
      * @param {String} configName the name of the configuration entry
@@ -495,7 +493,7 @@
         /*use(myfaces._impl._util)*/
         var _LangUtils = myfaces._impl._util._LangUtils;
 
-        if (_LangUtils.exists(myfaces,"config") && _LangUtils.exists(myfaces.config,configName)) {
+        if (_LangUtils.exists(myfaces, "config") && _LangUtils.exists(myfaces.config, configName)) {
             return myfaces.config[configName];
         }
         return defaultValue;
@@ -503,7 +501,7 @@
 
     /**
      * global eval on scripts
-     * 
+     *
      */
     myfaces._impl._util._Utils.globalEval = function(code) {
 
@@ -531,7 +529,7 @@
         var _LangUtils = myfaces._impl._util._LangUtils;
 
         var globalOption = myfaces._impl._util._Utils.getGlobalConfig(configName, defaultValue);
-        if(!_LangUtils.exists(localOptions, "myfaces") || !_LangUtils.exists(localOptions.myfaces,configName)) {
+        if (!_LangUtils.exists(localOptions, "myfaces") || !_LangUtils.exists(localOptions.myfaces, configName)) {
             return globalOption;
         }
         return localOptions.myfaces[configName];

Modified: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf_impl.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf_impl.js?rev=790222&r1=790221&r2=790222&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf_impl.js (original)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf_impl.js Wed Jul  1 15:42:29 2009
@@ -347,6 +347,8 @@
             } catch (e) {
             	myfaces.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_CLIENT_ERROR, "ErrorRetrievingResponse",
                     "Parts of the response couldn't be retrieved when constructing the event data: " + e);
+                //client errors are not swallowed 
+                throw e;
             }
         }
 

Modified: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js?rev=790222&r1=790221&r2=790222&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js (original)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js Wed Jul  1 15:42:29 2009
@@ -106,6 +106,7 @@
             }
         } catch (e) {
             this.m_exception.throwError(this.m_xhr, this.m_context, "send", e);
+           
         }
     };
 

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=790222&r1=790221&r2=790222&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 Wed Jul  1 15:42:29 2009
@@ -109,8 +109,6 @@
                  * </eval>
                  */
 
-
-
                 //this ought to be enough for eval
                 //however the run scripts still makes sense
                 //in the update and insert area for components
@@ -182,14 +180,11 @@
                 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) {
                 //DO nothing we do not have any implementation specifics for now!
                 //but if you need some implementation specific stuff
                 //you have to insert it here
-            //  this._responseHandler.doExtension(childNode);
-
+                //  this._responseHandler.doExtension(childNode);
             } else {
             	myfaces.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML);
                 return false;
@@ -235,18 +230,15 @@
             //a join is more efficient that normal string ops!
             cDataBlock = cDataBlock.join("");
 
-            var body = document.getElementsByTagName('body')[0];
-            var head = document.getElementsByTagName('head')[0];
-
             switch(node.getAttribute('id')) {
                 case "javax.faces.ViewRoot":
                     this._replaceBody(request, context,  cDataBlock );
 
                     break;
                 case "javax.faces.ViewHead":
-                    //we assume the cdata block is our head including the tag
-                    this._replaceElement(request, context, head, cDataBlock );
-
+                    //we cannot replace the head, almost no browser allows this, some of them throw errors
+                    //others simply ignore it or replace it and destroy the dom that way!
+                    throw new Error("Head cannot be replaced, due to browser deficiencies!");
 
                     break;
                 case "javax.faces.ViewBody":
@@ -282,11 +274,12 @@
         var bodyParent = oldBody.parentNode;
 
         newBody.appendChild(placeHolder);
-        bodyParent.replaceChild(newBody, oldBody);
 
         //the contextualFragment trick does not work on the body tag instead we have to generate a manual body
         //element and then add a child which then is the replacement holder for our fragment!
-        this._replaceElement(request, context, placeHolder , parser.parse(newData,"body") );
+        var bodyData = parser.parse(newData,"body");
+        bodyParent.replaceChild(newBody, oldBody);
+        this._replaceElement(request, context, placeHolder , bodyData );
 
         for(var key in parser.tagAttributes) {
             var value = parser.tagAttributes[key];

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=790222&r1=790221&r2=790222&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 Wed Jul  1 15:42:29 2009
@@ -34,7 +34,7 @@
  * 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");
+        var newException = new myfaces._impl.xhrCore._Exception(request, context, sourceClass, "ERROR");
         newException.throwError(request, context, func, exception);
     };
 
@@ -43,7 +43,7 @@
  * 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");
+        var newException = new myfaces._impl.xhrCore._Exception(request, context, sourceClass, "WARNING");
         newException.throwWarning(request, context, func, message);
     };
 
@@ -63,6 +63,9 @@
                 + "Error line number: " + exception.lineNumber);
         }
         this.destroy();
+        //client exceptions should not be swallowed they have to be delegated to the client itself!
+        //TODO check if we are even allowed to issue client errors via the ajax API!
+        throw exception;
     };
 
     /**