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 2008/05/10 17:22:54 UTC

svn commit: r655109 - /wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js

Author: jcompagner
Date: Sat May 10 08:22:54 2008
New Revision: 655109

URL: http://svn.apache.org/viewvc?rev=655109&view=rev
Log:
WICKET-1607 addDomReadyEvent unreliable for Safari

Modified:
    wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js

Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js?rev=655109&r1=655108&r2=655109&view=diff
==============================================================================
--- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js (original)
+++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js Sat May 10 08:22:54 2008
@@ -165,24 +165,22 @@
 					return;
 				window.loaded = true;
 				
-				// if there was a timer, clean it (khtml, safari)
-				if (Wicket.Event.domReadyTimer) {
-					clearTimeout(Wicket.Event.domReadyTimer);
-					Wicket.Event.domReadyTimer = null;
-				}
-				
 				// invoke the handlers
 				Wicket.Event.fireDomReadyHandlers();
 			}.bind(this);
 			
 			if (document.readyState && (Wicket.Browser.isKHTML() || Wicket.Browser.isSafari())) { 
-			   //safari and konqueror don't support the event - simulate it through a timeou
-				Wicket.Event.domReadyTimer = window.setTimeout(function() {
+			  //safari and konqueror don't support the event - simulate it through a timeout
+				var domCheck = function() {
 					if (document.readyState == "loaded" ||
 					    document.readyState == "complete") {
 					    domReady();
+					} else {
+						// dom not yet ready, set timer to check later
+						window.setTimeout(domCheck, 10);
 					}
-				}, 10);
+				}
+				window.setTimeout(domCheck, 10);
 			} else if (document.readyState && Wicket.Browser.isIE()) { 
 				if (document.getElementById('ie_ready') == null) {
 					// for internet explorer we need to load a "dummy" scrip from ::/ to get the