You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/05/08 15:30:48 UTC

git commit: WICKET-5181 Problem with OnEventHeaderItem and Wicket.Event.add

Updated Branches:
  refs/heads/wicket-6.x d863e48ad -> a8873e5b0


WICKET-5181 Problem with OnEventHeaderItem and Wicket.Event.add


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/a8873e5b
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/a8873e5b
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/a8873e5b

Branch: refs/heads/wicket-6.x
Commit: a8873e5b024db57e4cea9eff20611e681c29d6a3
Parents: d863e48
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed May 8 16:29:03 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed May 8 16:29:37 2013 +0300

----------------------------------------------------------------------
 .../wicket/ajax/res/js/wicket-event-jquery.js      |   26 ++++++++-------
 1 files changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/a8873e5b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
index e4cd887..12cb75e 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
@@ -144,18 +144,20 @@
 				if (type === 'domready') {
 					jQuery(fn);
 				} else {
-					type = (type === 'mousewheel' && Wicket.Browser.isGecko()) ? 'DOMMouseScroll' : type;
-					
-					var el = element;
-					if (typeof(element) === 'string') {
-						el = document.getElementById(element);
-					}
-					
-					if (!el && Wicket.Log) {
-						Wicket.Log.error('Cannot find element with id: ' + element);
-					}
-					
-					jQuery(el).on(type, data, fn);
+					// try to find the element once the DOM is ready
+					jQuery(function() {
+						type = (type === 'mousewheel' && Wicket.Browser.isGecko()) ? 'DOMMouseScroll' : type;
+						var el = element;
+						if (typeof(element) === 'string') {
+							el = document.getElementById(element);
+						}
+
+						if (!el && Wicket.Log) {
+							Wicket.Log.error('Cannot find element with id: ' + element);
+						}
+
+						jQuery(el).on(type, data, fn);
+					});
 				}
 				return element;
 			},