Author: ivaynberg
Date: Fri Aug  7 15:34:58 2009
New Revision: 802050

URL: http://svn.apache.org/viewvc?rev=802050&view=rev
Log:
WICEKT-2420: multipart ajax now works in firefox, chrome, safari. explorer 
still pukes.
Issue: WICKET-2420

Modified:
    
wicket/sandbox/ivaynberg/wicket-ajax-multipart/src/main/java/org/apache/wicket/ajax/wicket-ajax.js

Modified: 
wicket/sandbox/ivaynberg/wicket-ajax-multipart/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
URL: 
http://svn.apache.org/viewvc/wicket/sandbox/ivaynberg/wicket-ajax-multipart/src/main/java/org/apache/wicket/ajax/wicket-ajax.js?rev=802050&r1=802049&r2=802050&view=diff
==============================================================================
--- 
wicket/sandbox/ivaynberg/wicket-ajax-multipart/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
 (original)
+++ 
wicket/sandbox/ivaynberg/wicket-ajax-multipart/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
 Fri Aug  7 15:34:58 2009
@@ -1092,7 +1092,9 @@
                
                iframe.name="wicket-submit-"+Math.random(); // TODO make sure 
this is unique
                iframe.id=iframe.name;
-               iframe.onload=this.handleMultipartComplete.bind(this);
+               iframe.src="about:blank";
+               
+               Wicket.Event.add(iframe, "load", 
this.handleMultipartComplete.bind(this));
                
                document.body.appendChild(iframe);
                
@@ -1120,8 +1122,14 @@
                // stop the event
                if (event.stopPropagation) { event.stopPropagation(); } else 
{event.cancelBubble=true;}
 
+               // remove the event
+               if (iframe.detachEvent)  
+                       iframe.detachEvent("onload", 
this.handleMultipartComplete);  
+               else  
+                       iframe.removeEventListener("load", 
this.handleMultipartComplete, false);
+               
                // remove the iframe
-               document.body.removeChild(iframe);
+               setTimeout(function() { iframe.parentNode.removeChild(iframe); 
}, 250);
        },
        
        // Processes the response


Reply via email to