You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2007/12/14 15:18:25 UTC

svn commit: r604203 - in /wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax: AbstractDefaultAjaxBehavior.java wicket-ajax.js

Author: jcompagner
Date: Fri Dec 14 06:18:19 2007
New Revision: 604203

URL: http://svn.apache.org/viewvc?rev=604203&view=rev
Log:
fixes if ajax events on elements are done on components that are just are going to be replaced.
Javascript ajax handlings waits a bit before applying the changes and the pre condition script checks if the markup id is still there instead of checking the real element.

Modified:
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java?rev=604203&r1=604202&r2=604203&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java Fri Dec 14 06:18:19 2007
@@ -122,7 +122,7 @@
 	 */
 	protected CharSequence getPreconditionScript()
 	{
-		return "return Wicket.$$(this)";
+		return "return Wicket.$('" + getComponent().getMarkupId() + "') != null;";
 	}
 
 	/**

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js?rev=604203&r1=604202&r2=604203&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js Fri Dec 14 06:18:19 2007
@@ -1042,6 +1042,13 @@
 			// iinitialize the array for steps (closures that execute each action)
 		    var steps = new Array();
 
+		   // start it a bit later so that the browser does handle the next event 
+		   // before the component is or can be replaced. We could do (if (!posponed))
+		   // because if there is already something in the queue then we could execute that immedietly 
+			steps.push(function(notify) {
+			   window.setTimeout(notify,2);
+			}.bind(this));
+			
 		    if (Wicket.Browser.isKHTML()) {
 		    	// there's a nasty bug in KHTML that makes the browser crash
 		    	// when the methods are delayed. Therefore we have to fire it