Author: pyaschenko
Date: 2010-05-20 07:25:16 -0400 (Thu, 20 May 2010)
New Revision: 17155
Modified:
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
Log:
ajahttps://jira.jboss.org/browse/RF-8258
clear on onunload added
Modified: root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-05-20
10:51:00 UTC (rev 17154)
+++ root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-05-20
11:25:16 UTC (rev 17155)
@@ -52,8 +52,8 @@
}
//dom cleaner
- richfaces.cleanDom = function(id) {
- var e = document.getElementById(id);
+ richfaces.cleanDom = function(source) {
+ var e = (typeof source == "string") ? document.getElementById(source) :
jQuery('body').get(0);
if (e) {
var elements = e.getElementsByTagName("*");
if (elements.length) {
@@ -733,11 +733,11 @@
};
}()));
- richfaces.ajax.onComplete = function (data) {
+ var ajaxOnComplete = function (data) {
var type = data.type;
var responseXML = data.responseXML;
- if (data.type == 'event' && data.status == "complete"
&& responseXML) {
+ if (data.type == 'event' && data.status == 'complete'
&& responseXML) {
var partialResponse = jQuery(responseXML).children("partial-response");
if (partialResponse && partialResponse.length) {
var elements = partialResponse.children('changes').children('update,
delete');
@@ -749,7 +749,12 @@
};
// move this code to somewhere
if (typeof jsf != 'undefined') {
- jsf.ajax.addOnEvent(richfaces.ajax.onComplete);
+ jsf.ajax.addOnEvent(ajaxOnComplete);
}
+ if (window.addEventListener) {
+ window.addEventListener("unload", richfaces.cleanDom, false);
+ } else {
+ window.attachEvent("onunload", richfaces.cleanDom);
+ }
}(jQuery, RichFaces));