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 09:33:33 UTC
svn commit: r767834 - in
/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces:
_impl/_util/_Utils.js _impl/xhrCore/_AjaxResponse.js api/jsf.js
Author: werpu
Date: Thu Apr 23 07:33:33 2009
New Revision: 767834
URL: http://svn.apache.org/viewvc?rev=767834&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-2194
https://issues.apache.org/jira/browse/MYFACES-2192
https://issues.apache.org/jira/browse/MYFACES-2200
https://issues.apache.org/jira/browse/MYFACES-2174
Thank you Alexander Bell and Ganesh Jung for providing the patches...
Modified:
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/xhrCore/_AjaxResponse.js
myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/api/jsf.js
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=767834&r1=767833&r2=767834&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 Thu Apr 23 07:33:33 2009
@@ -14,7 +14,7 @@
* limitations under the License.
*
* Author: Ganesh Jung (latest modification by $Author: ganeshpuri $)
- * Version: $Revision: 1.9 $ $Date: 2009/04/18 17:19:12 $
+ * Version: $Revision: 1.10 $ $Date: 2009/04/21 05:53:14 $
*
*/
@@ -221,7 +221,6 @@
*/
myfaces._impl._util._Utils.getElementFromForm = function(request, context, itemId, form) {
try {
-
if('undefined' == typeof form || form == null) {
return document.getElementById(itemId);
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=767834&r1=767833&r2=767834&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 07:33:33 2009
@@ -14,7 +14,7 @@
* limitations under the License.
*
* Author: Ganesh Jung (latest modification by $Author: ganeshpuri $)
- * Version: $Revision: 1.14 $ $Date: 2009/04/18 17:19:12 $
+ * Version: $Revision: 1.15 $ $Date: 2009/04/21 05:53:14 $
*
*/
@@ -105,232 +105,291 @@
//we might add this one as custom option in update and
//insert!
if (tagName == this._PCMD_ERROR) {
-
- /**
- * <error>
- * <error-name>String</error-name>
- * <error-message><![CDATA[message]]></error-message>
- * <error>
- */
- var errorName = childNode.firstChild.textContent;
- var errorMessage = childNode.childNodes[1].firstChild.data;
+ 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);
+ }
+};
- if('undefined' == typeof errorName || null == errorName) {
- errorName = "";
- }
- if('undefined' == typeof errorMessage || null == errorMessage) {
- errorMessage = "";
- }
+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;
+
+ 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) {
+ /**
+ * <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;
+ }
+ 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);
- return;
-
+ } else {
+ jsf.ajax.sendError(request, context, myfaces._impl.core._jsfImpl._ERROR_MALFORMEDXML);
+ return false;
+ }
+ }
+ return true;
+}
- } else if (tagName == this._PCMD_REDIRECT) {
- /**
- * <redirect url="url to redirect" />
- */
- var redirectUrl = childNode.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;
+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);
+ }
+ }
+ 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);
}
- redirectUrl = myfaces._impl._util._LangUtils.trim(redirectUrl);
- if(redirectUrl == "") {
- return;
+ }
+ 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);
}
- window.location = redirectUrl;
-
+ }
+//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);
+ }
+ }
- } else if (tagName == this._PCMD_CHANGES) {
- var changes = childNode.childNodes;
+ //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);
+ }
+ } else {
+ myfaces._impl._util._Utils.replaceHtmlItem(request, context,
+ node.getAttribute('id'), cDataBlock, this.m_htmlFormElement);
+ }
+ }
+ return true;
+}
- for (var i = 0; i < changes.length; i++) {
- if (changes[i].tagName == "update") {
- if (changes[i].getAttribute('id') == "javax.faces.ViewState") {
- document.getElementById("javax.faces.ViewState").value = changes[i].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 {
- //TODO make a special head body and html handling here
- var cDataBlock = changes[i].firstChild.data;
- if( changes[i].getAttribute('id') == "javax.faces.ViewRoot") {
-
- //lets strip the internal html if given
- var htmlContent = myfaces._impl._util._Utils.stripHtml(cDataBlock);
- htmlContent = (htmlContent == null) ? cDataBlock: headContent;
- var headContent = myfaces._impl._util._Utils.stripHead(htmlContent);
- var bodyContent = myfaces._impl._util._Utils.stripBody(htmlContent);
- var body = document.getElementsByTagName('body')[0];
- var head = document.getElementsByTagName('head')[0];
-
- if(headContent != null) {
-
- head.innerHTML = headContent;
- //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(bodyContent != null) {
- //TODO replace the innerHTML with the j4fry logic
- body.innerHTML = bodyContent
- //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, head);
- }
- //no body content is defined means we have to replace the body with the entire cdata content
- } else {
- body = cDataBlock;
- if (myfaces._impl._util._Utils.isUserAgentInternetExplorer()) {
- myfaces._impl._util._Utils.runScripts(request, context, head);
- }
- }
- } else {
- myfaces._impl._util._Utils.replaceHtmlItem(request, context,
- changes[i].getAttribute('id'), cDataBlock, this.m_htmlFormElement);
- }
- }
- } 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) {
- // this._responseHandler.doInsert(childNode);
- /*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
- **/
- var insertId = changes[i].getAttribute('id');
- var beforeId = changes[i].getAttribute('before');
- var afterId = changes[i].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;
- }
- 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;
- }
- //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;
- }
- /**
- *we generate a temp holder
- *so that we can use innerHTML for
- *generating the content upfront
- *before inserting it"
- **/
- var nodeHolder = document.createElement("div");
- //nodeHolder.innerHTML = changes[i].firstChild.data;
- var parentNode = beforeNode.parentNode;
- parentNode.insertBefore(nodeHolder, beforeNode);
-
- myfaces._impl._util._Utils.replaceHtmlItem(request, context,
- nodeHolder, changes[i].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;
- }
- var nodeHolder = document.createElement("div");
- //nodeHolder.innerHTML = changes[i].firstChild.data;
- var parentNode = afterNode.parentNode;
- parentNode.insertBefore(nodeHolder, afterNode.nextSibling);
- myfaces._impl._util._Utils.replaceHtmlItem(request, context,
- nodeHolder, changes[i].firstChild.data, null);
- }
-
- } else if (changes[i].tagName == this._PCMD_DELETE) {
- // this._responseHandler.doDelete(childNode);
- var deleteId = changes[i].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;
- }
-
- myfaces._impl._util._Utils.deleteItem(request, context, deleteId, "","");
-
- } else if (changes[i].tagName == this._PCMD_ATTRIBUTES) {
- //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 = changes[i];
- 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;
- }
- var childs = attributesRoot.childNodes;
-
- if('undefined' == typeof childs || null == childs) {
- return;
- }
- 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;
- }
-
- 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);
- }
-
- // 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;
- }
+/*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);
+
+ 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,
+ 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;
+ }
+
+ 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;
+
+ 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");
+
+ if('undefined' == typeof attributeName || null == attributeName) {
+ continue;
}
- } catch (e) {
- this.m_exception.throwError(request, context, "processResponse", e);
+
+ 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;
+}
\ 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=767834&r1=767833&r2=767834&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 07:33:33 2009
@@ -92,7 +92,7 @@
}
jsf.ajax.addOnEvent = function(/*function*/eventListener) {
- return jsf.ajax._impl.addOnError(eventListener);
+ return jsf.ajax._impl.addOnEvent(eventListener);
}
/**