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/06 17:46:20 UTC

svn commit: r601785 - /wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js

Author: jcompagner
Date: Thu Dec  6 08:46:19 2007
New Revision: 601785

URL: http://svn.apache.org/viewvc?rev=601785&view=rev
Log:
if the element which much be binded to a function is the window then call directly fn.bind() else call it through the Wicket.Event.handler

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

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js?rev=601785&r1=601784&r2=601785&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js Thu Dec  6 08:46:19 2007
@@ -122,11 +122,19 @@
 			if (element.addEventListener){
 				element.addEventListener((type == 'mousewheel' && window.gecko) ? 'DOMMouseScroll' : type, fn, false);
 			} else {
-				fn = Wicket.Event.handler.bind([Wicket.Event.getId(element), fn]);				
+			   if (element == window)
+			   {
+			   	fn = fn.bind(element);
+			   }
+			   else
+			   {
+					fn = Wicket.Event.handler.bind([Wicket.Event.getId(element), fn]);
+				}				
 				// Because of the fn.bind (returning a new function object)
 				// you can't detach the event first to be sure that there are no doubles :(
 				//element.detachEvent('on'+type, fn);
 				element.attachEvent('on'+type, fn);
+
 			}
 		}
 		return element;