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:29:40 UTC

[1/2] git commit: WICKET-5178 StopPropagation functionality on link is broken

Updated Branches:
  refs/heads/master da30ffc2e -> bc00a9001


WICKET-5178 StopPropagation functionality on link is broken


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

Branch: refs/heads/master
Commit: cb866ab27e681ec11699ba58bd6d073402573042
Parents: da30ffc
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed May 8 16:28:42 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed May 8 16:28:42 2013 +0300

----------------------------------------------------------------------
 .../wicket/ajax/res/js/wicket-ajax-jquery.js       |   44 ++++++--------
 1 files changed, 19 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/cb866ab2/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 7d37884..31954ae 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -447,13 +447,22 @@
 		 *
 		 * @param {Object} attrs - the Ajax request attributes configured at the server side
 		 */
-		_preventDefaultIfNecessary: function(attrs) {
-			if (!attrs.ad && attrs.event) {
-				try {
-					attrs.event.preventDefault();
-				} catch (ignore) {
-					// WICKET-4986
-					// jquery fails 'member not found' with calls on busy channel
+		_handleEventCancelation: function(attrs) {
+			var evt = attrs.event;
+			if (evt) {
+				if (!attrs.ad) {
+					try {
+						evt.preventDefault();
+					} catch (ignore) {
+						// WICKET-4986
+						// jquery fails 'member not found' with calls on busy channel
+					}
+				}
+
+				if (attrs.sp === "stop") {
+					Wicket.Event.stop(evt);
+				} else if (attrs.sp === "stopImmediate") {
+					Wicket.Event.stop(evt, true);
 				}
 			}
 		},
@@ -548,7 +557,7 @@
 
 			if (attrs.mp) { // multipart form. jQuery.ajax() doesn't help here ...
 				var ret = self.submitMultipartForm(context);
-				self._preventDefaultIfNecessary(attrs);
+				self._handleEventCancelation(attrs);
 				return ret;
 			}
 
@@ -656,8 +665,8 @@
 			self._executeHandlers(attrs.ah, attrs);
 			Wicket.Event.publish('/ajax/call/after', attrs);
 
-			self._preventDefaultIfNecessary(attrs);
-			
+			self._handleEventCancelation(attrs);
+
 			return jqXHR;
 		},
 
@@ -1745,19 +1754,6 @@
 
 			ajax: function(attrs) {
 
-				var handleStopPropagation = function (attributes) {
-					var result = false;
-					var evt = attributes.event;
-					if (attributes.sp === "stop") {
-						Wicket.Event.stop(evt);
-					} else if (attributes.sp === "stopImmediate") {
-						Wicket.Event.stop(evt, true);
-					} else {
-						result = true;
-					}
-					return result;
-				};
-
 				attrs.c = attrs.c || window;
 				attrs.e = attrs.e || [ 'domready' ];
 
@@ -1781,12 +1777,10 @@
 							throttler.throttle(throttlingSettings.id, throttlingSettings.d,
 								Wicket.bind(function () {
 									call.ajax(attributes);
-									return handleStopPropagation(attributes);
 								}, this));
 						}
 						else {
 							call.ajax(attributes);
-							return handleStopPropagation(attributes);
 						}
 					});
 				});


[2/2] git commit: WICKET-5181 Problem with OnEventHeaderItem and Wicket.Event.add

Posted by mg...@apache.org.
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/bc00a900
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/bc00a900
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/bc00a900

Branch: refs/heads/master
Commit: bc00a9001dc8071a37bfed6050e481bd74f50275
Parents: cb866ab
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:03 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/bc00a900/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;
 			},