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/13 15:10:47 UTC
[1/5] git commit: WICKET-5178 StopPropagation functionality on link
is broken
Updated Branches:
refs/heads/wicket-6.x 63190c90a -> 70a7ad206
WICKET-5178 StopPropagation functionality on link is broken
Add an additional setting for JavaScript stopPropagation functionality
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/a16a1276
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/a16a1276
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/a16a1276
Branch: refs/heads/wicket-6.x
Commit: a16a127686705332df3b927fdb15a090eb52e018
Parents: 63190c9
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed May 8 15:37:11 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 13 16:09:01 2013 +0300
----------------------------------------------------------------------
.../wicket/ajax/AbstractDefaultAjaxBehavior.java | 9 +++
.../wicket/ajax/attributes/AjaxAttributeName.java | 7 ++
.../ajax/attributes/AjaxRequestAttributes.java | 50 ++++++++++++++-
.../wicket/ajax/res/js/wicket-ajax-jquery.js | 19 ++++++
4 files changed, 84 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/a16a1276/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
index cd2b1d8..49264c8 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
@@ -345,6 +345,15 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
attributesJson.put(AjaxAttributeName.IS_ALLOW_DEFAULT.jsonName(), true);
}
+ if (AjaxRequestAttributes.StopPropagation.NO.equals(attributes.getStopPropagation()))
+ {
+ attributesJson.put(AjaxAttributeName.STOP_PROPAGATION.jsonName(), "no");
+ }
+ else if (AjaxRequestAttributes.StopPropagation.STOP_IMMEDIATE.equals(attributes.getStopPropagation()))
+ {
+ attributesJson.put(AjaxAttributeName.STOP_PROPAGATION.jsonName(), "stopImmediate");
+ }
+
Duration requestTimeout = attributes.getRequestTimeout();
if (requestTimeout != null)
{
http://git-wip-us.apache.org/repos/asf/wicket/blob/a16a1276/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java
index e2f9b30..4305fae 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java
@@ -83,6 +83,13 @@ public enum AjaxAttributeName {
IS_ALLOW_DEFAULT("ad"),
/**
+ * stop propagation
+ *
+ * @see AjaxRequestAttributes#setStopPropagation(org.apache.wicket.ajax.attributes.AjaxRequestAttributes.StopPropagation)
+ */
+ STOP_PROPAGATION("sp"),
+
+ /**
* channel (ch)
*
* @see AjaxRequestAttributes#getChannel()
http://git-wip-us.apache.org/repos/asf/wicket/blob/a16a1276/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
index 8cb4759..cc7386c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
@@ -35,7 +35,8 @@ public final class AjaxRequestAttributes
/**
* The method to be used when submitting a form
*/
- public static enum Method {
+ public static enum Method
+ {
/** get */
GET,
@@ -49,6 +50,28 @@ public final class AjaxRequestAttributes
}
}
+ /**
+ * The JavaScript event propagation type
+ */
+ public static enum StopPropagation
+ {
+ /**
+ * Stops the propagation of the JavaScript event to the parent of its target
+ */
+ STOP,
+
+ /**
+ * Stops the propagation of the JavaScript event to the parent of its target
+ * and all other event listeners registered on the same target
+ */
+ STOP_IMMEDIATE,
+
+ /**
+ * Do not stop the propagation of the JavaScript event
+ */
+ NO
+ }
+
public static final String XML_DATA_TYPE = "xml";
private boolean multipart = false;
@@ -59,6 +82,8 @@ public final class AjaxRequestAttributes
private boolean allowDefault = false;
+ private StopPropagation stopPropagation = StopPropagation.STOP;
+
/**
* The names of the events which will trigger the Ajax call
*/
@@ -279,6 +304,15 @@ public final class AjaxRequestAttributes
}
/**
+ * Only applies for event behaviors. Returns whether the behavior should allow the JavaScript event
+ * to propagate to the parent of its target.
+ */
+ public StopPropagation getStopPropagation()
+ {
+ return stopPropagation;
+ }
+
+ /**
* Only applies for event behaviors. Determines whether the behavior should allow the default
* event handler to be invoked.
*
@@ -295,6 +329,20 @@ public final class AjaxRequestAttributes
}
/**
+ * Only applies to event behaviors. Determines whether the behavior should allow the
+ * JavaScript event to propagate to the parent of its target.
+ *
+ * @param stopPropagation
+ * the type of the stop
+ * @return {@code this} object, for chaining
+ */
+ public AjaxRequestAttributes setStopPropagation(StopPropagation stopPropagation)
+ {
+ this.stopPropagation = Args.notNull(stopPropagation, "stopPropagation");
+ return this;
+ }
+
+ /**
* @param async
* a flag whether to do asynchronous Ajax call or not
* @return {@code this} object for chaining
http://git-wip-us.apache.org/repos/asf/wicket/blob/a16a1276/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 2e5e02f..b876751 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
@@ -361,6 +361,10 @@
if (attrs.ad !== true) {
attrs.ad = false;
}
+
+ if (!attrs.sp) {
+ attrs.sp = "stop";
+ }
},
/**
@@ -1764,6 +1768,19 @@
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' ];
@@ -1787,10 +1804,12 @@
throttler.throttle(throttlingSettings.id, throttlingSettings.d,
Wicket.bind(function () {
call.ajax(attributes);
+ return handleStopPropagation(attributes);
}, this));
}
else {
call.ajax(attributes);
+ return handleStopPropagation(attributes);
}
});
});
[5/5] git commit: WICKET-5178 StopPropagation functionality on link
is broken
Posted by mg...@apache.org.
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/70a7ad20
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/70a7ad20
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/70a7ad20
Branch: refs/heads/wicket-6.x
Commit: 70a7ad2062d3210982c36482e0daea3766b2bf6e
Parents: f5e8f6d
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon May 13 16:07:06 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 13 16:10:38 2013 +0300
----------------------------------------------------------------------
.../wicket/ajax/res/js/wicket-ajax-jquery.js | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/70a7ad20/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 7a17267..fdce64e 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
@@ -1811,13 +1811,12 @@
throttler.throttle(throttlingSettings.id, throttlingSettings.d,
Wicket.bind(function () {
call.ajax(attributes);
- Wicket.Ajax._handleEventCancelation(attributes);
}, this));
}
else {
call.ajax(attributes);
- Wicket.Ajax._handleEventCancelation(attributes);
}
+ Wicket.Ajax._handleEventCancelation(attributes);
});
});
},
[2/5] git commit: WICKET-5178 StopPropagation functionality on link
is broken
Posted by mg...@apache.org.
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/b8a6a5ea
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/b8a6a5ea
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/b8a6a5ea
Branch: refs/heads/wicket-6.x
Commit: b8a6a5ea5c36a84b63d84e2d995b41329cf4b583
Parents: a16a127
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed May 8 16:28:42 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 13 16:09:13 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/b8a6a5ea/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 b876751..7b3f34a 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;
},
@@ -1768,19 +1777,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' ];
@@ -1804,12 +1800,10 @@
throttler.throttle(throttlingSettings.id, throttlingSettings.d,
Wicket.bind(function () {
call.ajax(attributes);
- return handleStopPropagation(attributes);
}, this));
}
else {
call.ajax(attributes);
- return handleStopPropagation(attributes);
}
});
});
[3/5] git commit: WICKET-5178 StopPropagation functionality on link
is broken WICKET-5093 The event listener in Wicket.Ajax.ajax() should not
return the value of attrs.ad (allowDefault)
Posted by mg...@apache.org.
WICKET-5178 StopPropagation functionality on link is broken
WICKET-5093 The event listener in Wicket.Ajax.ajax() should not return the value of attrs.ad (allowDefault)
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d58576b3
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d58576b3
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d58576b3
Branch: refs/heads/wicket-6.x
Commit: d58576b359f6beb00053d3240315bb5d147940d4
Parents: b8a6a5e
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon May 13 15:21:05 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 13 16:10:14 2013 +0300
----------------------------------------------------------------------
.../wicket/ajax/AbstractDefaultAjaxBehavior.java | 8 +-
.../wicket/ajax/attributes/AjaxAttributeName.java | 4 +-
.../ajax/attributes/AjaxRequestAttributes.java | 16 ++--
.../wicket/ajax/res/js/wicket-ajax-jquery.js | 55 +++++++--------
4 files changed, 41 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/d58576b3/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
index 49264c8..1cd9ec6 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
@@ -345,13 +345,13 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
attributesJson.put(AjaxAttributeName.IS_ALLOW_DEFAULT.jsonName(), true);
}
- if (AjaxRequestAttributes.StopPropagation.NO.equals(attributes.getStopPropagation()))
+ if (AjaxRequestAttributes.EventPropagation.BUBBLE.equals(attributes.getEventPropagation()))
{
- attributesJson.put(AjaxAttributeName.STOP_PROPAGATION.jsonName(), "no");
+ attributesJson.put(AjaxAttributeName.EVENT_PROPAGATION.jsonName(), "bubble");
}
- else if (AjaxRequestAttributes.StopPropagation.STOP_IMMEDIATE.equals(attributes.getStopPropagation()))
+ else if (AjaxRequestAttributes.EventPropagation.STOP_IMMEDIATE.equals(attributes.getEventPropagation()))
{
- attributesJson.put(AjaxAttributeName.STOP_PROPAGATION.jsonName(), "stopImmediate");
+ attributesJson.put(AjaxAttributeName.EVENT_PROPAGATION.jsonName(), "stopImmediate");
}
Duration requestTimeout = attributes.getRequestTimeout();
http://git-wip-us.apache.org/repos/asf/wicket/blob/d58576b3/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java
index 4305fae..1042deb 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java
@@ -85,9 +85,9 @@ public enum AjaxAttributeName {
/**
* stop propagation
*
- * @see AjaxRequestAttributes#setStopPropagation(org.apache.wicket.ajax.attributes.AjaxRequestAttributes.StopPropagation)
+ * @see AjaxRequestAttributes#setEventPropagation(org.apache.wicket.ajax.attributes.AjaxRequestAttributes.EventPropagation)
*/
- STOP_PROPAGATION("sp"),
+ EVENT_PROPAGATION("sp"),
/**
* channel (ch)
http://git-wip-us.apache.org/repos/asf/wicket/blob/d58576b3/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
index cc7386c..896c4fd 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
@@ -53,7 +53,7 @@ public final class AjaxRequestAttributes
/**
* The JavaScript event propagation type
*/
- public static enum StopPropagation
+ public static enum EventPropagation
{
/**
* Stops the propagation of the JavaScript event to the parent of its target
@@ -69,7 +69,7 @@ public final class AjaxRequestAttributes
/**
* Do not stop the propagation of the JavaScript event
*/
- NO
+ BUBBLE
}
public static final String XML_DATA_TYPE = "xml";
@@ -82,7 +82,7 @@ public final class AjaxRequestAttributes
private boolean allowDefault = false;
- private StopPropagation stopPropagation = StopPropagation.STOP;
+ private EventPropagation eventPropagation = EventPropagation.STOP;
/**
* The names of the events which will trigger the Ajax call
@@ -307,9 +307,9 @@ public final class AjaxRequestAttributes
* Only applies for event behaviors. Returns whether the behavior should allow the JavaScript event
* to propagate to the parent of its target.
*/
- public StopPropagation getStopPropagation()
+ public EventPropagation getEventPropagation()
{
- return stopPropagation;
+ return eventPropagation;
}
/**
@@ -332,13 +332,13 @@ public final class AjaxRequestAttributes
* Only applies to event behaviors. Determines whether the behavior should allow the
* JavaScript event to propagate to the parent of its target.
*
- * @param stopPropagation
+ * @param eventPropagation
* the type of the stop
* @return {@code this} object, for chaining
*/
- public AjaxRequestAttributes setStopPropagation(StopPropagation stopPropagation)
+ public AjaxRequestAttributes setEventPropagation(EventPropagation eventPropagation)
{
- this.stopPropagation = Args.notNull(stopPropagation, "stopPropagation");
+ this.eventPropagation = Args.notNull(eventPropagation, "eventPropagation");
return this;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/d58576b3/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 7b3f34a..e4930ec 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
@@ -443,31 +443,6 @@
},
/**
- * Aborts the default event if attributes request it
- *
- * @param {Object} attrs - the Ajax request attributes configured at the server side
- */
- _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);
- }
- }
- },
-
- /**
* Executes or schedules for execution #doAjax()
*
* @param {Object} attrs - the Ajax request attributes configured at the server side
@@ -557,7 +532,6 @@
if (attrs.mp) { // multipart form. jQuery.ajax() doesn't help here ...
var ret = self.submitMultipartForm(context);
- self._handleEventCancelation(attrs);
return ret;
}
@@ -665,8 +639,6 @@
self._executeHandlers(attrs.ah, attrs);
Wicket.Event.publish('/ajax/call/after', attrs);
- self._handleEventCancelation(attrs);
-
return jqXHR;
},
@@ -1761,6 +1733,31 @@
Call: Wicket.Ajax.Call,
+ /**
+ * Aborts the default event if attributes request it
+ *
+ * @param {Object} attrs - the Ajax request attributes configured at the server side
+ */
+ _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);
+ }
+ }
+ },
+
get: function (attrs) {
attrs.m = 'GET';
@@ -1800,10 +1797,12 @@
throttler.throttle(throttlingSettings.id, throttlingSettings.d,
Wicket.bind(function () {
call.ajax(attributes);
+ Wicket.Ajax._handleEventCancelation(attributes);
}, this));
}
else {
call.ajax(attributes);
+ Wicket.Ajax._handleEventCancelation(attributes);
}
});
});
[4/5] git commit: WICKET-5186 Use arrays instead of String
concatenation in JavaScript for better performance
Posted by mg...@apache.org.
WICKET-5186 Use arrays instead of String concatenation in JavaScript for better performance
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/f5e8f6dc
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/f5e8f6dc
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/f5e8f6dc
Branch: refs/heads/wicket-6.x
Commit: f5e8f6dc92c39aaf3ceb8b79765bcb8256a4e3f5
Parents: d58576b
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon May 13 15:38:50 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 13 16:10:28 2013 +0300
----------------------------------------------------------------------
.../wicket/ajax/res/js/wicket-ajax-jquery.js | 54 +++++++++------
1 files changed, 34 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/f5e8f6dc/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 e4930ec..7a17267 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
@@ -1629,7 +1629,7 @@
if (isUndef(node)) {
return "";
}
- var result = "";
+ var result = [];
if (node.childNodes.length > 0) {
for (var i = 0; i < node.childNodes.length; i++) {
@@ -1637,50 +1637,60 @@
switch (thisNode.nodeType) {
case 1: // ELEMENT_NODE
case 5: // ENTITY_REFERENCE_NODE
- result += this.serializeNode(thisNode);
+ result.push(this.serializeNode(thisNode));
break;
case 8: // COMMENT
- result += "<!--" + thisNode.nodeValue + "-->";
+ result.push("<!--");
+ result.push(thisNode.nodeValue);
+ result.push("-->");
break;
case 4: // CDATA_SECTION_NODE
- result += "<![CDATA[" + thisNode.nodeValue + "]]>";
+ result.push("<![CDATA[");
+ result.push(thisNode.nodeValue);
+ result.push("]]>");
break;
case 3: // TEXT_NODE
case 2: // ATTRIBUTE_NODE
- result += thisNode.nodeValue;
+ result.push(thisNode.nodeValue);
break;
default:
break;
}
}
} else {
- result += node.textContent || node.text;
+ result.push(node.textContent || node.text);
}
- return result;
+ return result.join("");
},
serializeNode: function (node){
if (isUndef(node)) {
return "";
}
- var result = "";
- result += '<' + node.nodeName;
+ var result = [];
+ result.push("<");
+ result.push(node.nodeName);
if (node.attributes && node.attributes.length > 0) {
for (var i = 0; i < node.attributes.length; i++) {
// serialize the attribute only if it has meaningful value that is not inherited
if (node.attributes[i].nodeValue && node.attributes[i].specified) {
- result += " " + node.attributes[i].name +
- "=\"" + node.attributes[i].value + "\"";
+ result.push(" ");
+ result.push(node.attributes[i].name);
+ result.push("=\"");
+ result.push(node.attributes[i].value);
+ result.push("\"");
}
}
}
- result += '>';
- result += Wicket.DOM.serializeNodeChildren(node);
- result += '</' + node.nodeName + '>';
- return result;
+ result.push(">");
+ result.push(Wicket.DOM.serializeNodeChildren(node));
+ result.push("</");
+ result.push(node.nodeName);
+ result.push(">");
+ return result.join("");
},
// Utility function that determines whether given element is part of the current document
@@ -1699,7 +1709,11 @@
* @param node the root node
*/
text: function (node) {
- var result = "";
+ if (isUndef(node)) {
+ return "";
+ }
+
+ var result = [];
if (node.childNodes.length > 0) {
for (var i = 0; i < node.childNodes.length; i++) {
@@ -1707,21 +1721,21 @@
switch (thisNode.nodeType) {
case 1: // ELEMENT_NODE
case 5: // ENTITY_REFERENCE_NODE
- result += this.text(thisNode);
+ result.push(this.text(thisNode));
break;
case 3: // TEXT_NODE
case 4: // CDATA_SECTION_NODE
- result += thisNode.nodeValue;
+ result.push(thisNode.nodeValue);
break;
default:
break;
}
}
} else {
- result += node.textContent || node.text;
+ result.push(node.textContent || node.text);
}
- return result;
+ return result.join("");
}
},