[Xsltforms-support] Two defects in xforms.close method
Brought to you by:
alain-couthures
From: Ivan P. <ipo...@ma...> - 2011-04-18 10:16:01
|
Dear Alain, as soon as our date picker bugfix proved to be useful, maybe you will find some time to include another piece of our code in /trunk, so we will not have to continue merging our patches into your code? Thanks a lot in advance! As I wrote once, we are dependent on xforms.close() method, because we are showing and hiding XForms dynamically using AJAX without page reload, and the problem is that standard version of xforms.close() actually doesn't clean up everything! This causes two problems I reported earlier, this one: http://sourceforge.net/mailarchive/forum.php?thread_name=4D332B30.8070300%40mail.ru&forum_name=xsltforms-support and the first of the two given here (thanks God, we're completely finished with the second one): http://sourceforge.net/mailarchive/forum.php?thread_name=4D3A0CE5.4020709%40mail.ru&forum_name=xsltforms-support We solved both of them, here is a solution: in xforms.close method, after xforms.dispose(... (1627) the following code should be inserted: Calendar.INSTANCE = null; /*so the next time this object will be recreated and all event handlers will be bound properly*/ dropHasXFElement(document.documentElement); where /*Just full recursion over the whole DOM to remove hasXFElement attributes that will spoil everything the next time!!*/ function dropHasXFElement(element){ element.hasXFElement = null; var subelement = element.firstChild; while(subelement){ if (subelement.nodeType == NodeType.ELEMENT) dropHasXFElement(subelement); subelement = subelement.nextSibling; } } Regards, Ivan Ponomarev. |