diff options
-rw-r--r-- | gwtquery-core/pom.xml | 2 | ||||
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Events.java | 23 | ||||
-rw-r--r-- | pom.xml | 2 |
3 files changed, 23 insertions, 4 deletions
diff --git a/gwtquery-core/pom.xml b/gwtquery-core/pom.xml index 31aede2d..1ef308f8 100644 --- a/gwtquery-core/pom.xml +++ b/gwtquery-core/pom.xml @@ -8,7 +8,7 @@ <artifactId>gwtquery</artifactId> <packaging>jar</packaging> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> <name>Gwt Query Core API</name> <url>http://gquery.org</url> <dependencies> diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Events.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Events.java index c89cf884..101ae0b9 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Events.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Events.java @@ -17,7 +17,6 @@ import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.FormElement; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.dom.client.Node; -import com.google.gwt.event.dom.client.HasNativeEvent; import com.google.gwt.query.client.Function; import com.google.gwt.query.client.GQuery; import com.google.gwt.query.client.js.JsUtils; @@ -401,7 +400,7 @@ public class Events extends GQuery { // Ie6-8 don't dispatch bitless event if ((browser.ie6 || browser.ie8) && Event.getTypeInt(evt.getType()) == -1) { - EventsListener.getInstance(e).dispatchEvent(evt.<Event>cast()); + bubbleEventForIE(e, evt.<Event>cast()); } else { e.dispatchEvent(evt); } @@ -414,6 +413,26 @@ public class Events extends GQuery { } } + private void bubbleEventForIE(Element e, Event event) { + if (e == null || "html".equalsIgnoreCase(e.getTagName()) || isEventPropagationStopped(event)) { + return; + } + + EventsListener.getInstance(e).dispatchEvent(event); + + bubbleEventForIE(e.getParentElement(), event); + } + + /** + * Only valid for IE6-8 + * @param event + * @return + */ + private boolean isEventPropagationStopped(Event event) { + // trick to avoid jnsi + return event.<Element>cast().getPropertyBoolean("cancelBubble"); + } + private void callHandlers(Element e, NativeEvent evt, Function... functions){ for (Function f : functions) { f.setEvent(Event.as(evt)); @@ -3,7 +3,7 @@ <groupId>com.googlecode.gwtquery</groupId> <artifactId>gwtquery-project</artifactId> <packaging>pom</packaging> - <version>1.4.1</version> + <version>1.4.2-SNAPSHOT</version> <name>Gwt Query Project</name> <url>http://gwtquery.com</url> <description>GwtQuery is a jQuery clone written in GWT.</description> |