Skip to main content

Search and Top Navigation

#7324 closed bug (fixed)

Opened May 05, 2011 07:49AM UTC

Closed January 12, 2012 02:00PM UTC

Last modified January 12, 2012 02:07PM UTC

simulate mouse events broken for IE 9

Reported by: pstadt Owned by: rdworth
Priority: minor Milestone: 1.8.18
Component: [meta] ui.test Version: 1.8.11
Keywords: Cc:
Blocked by: Blocking:
Description

I am using jquery.simulate.js for several simulated drags on my application.

Looks like IE 9 in IE 9 mode supports document.createEvent now, but the created events do not work correctly.

It still supports document.createEventObject so I forced IE to use it, but I do not think it is a good solution (this is why I did not fork):

--- js/jquery.simulate.js
+++ js/jquery.simulate.js
@@ -53,7 +53,7 @@
 
                var relatedTarget = $(e.relatedTarget)[0];
 
-               if ($.isFunction(document.createEvent)) {
+               if (($.isFunction(document.createEvent)) && (!$.browser.msie)) {
                        evt = document.createEvent("MouseEvents");
                        evt.initMouseEvent(type, e.bubbles, e.cancelable, e.view, e.detail,
                                e.screenX, e.screenY, e.clientX, e.clientY,
@@ -100,7 +100,7 @@
        },
 
        dispatchEvent: function(el, type, evt) {
-               if (el.dispatchEvent) {
+               if ((el.dispatchEvent) && (!$.browser.msie)) {
                        el.dispatchEvent(evt);
                } else if (el.fireEvent) {
                        el.fireEvent('on' + type, evt);

A better solutuion, like playing with e.button values for ie9 did not help, maybe there are additional required evt attributes for IE.

Attachments (0)
Change History (8)

Changed May 05, 2011 05:03PM UTC by pstadt comment:1

Created a fiddle for this: http://jsfiddle.net/BYJTp/

Javscript is the full actual jquery.simulate.js, other stuff is embedded in html.

Changed October 13, 2011 01:52PM UTC by rdworth comment:2

owner: → rdworth
status: newassigned

I tried your patch in Document Mode: IE9 Standards Mode and got an error "No such interface supported"

Changed October 13, 2011 01:54PM UTC by rdworth comment:3

The problem seems to be that pageX and pageY values are coming through as 0. It seems these don't need to specified, browsers calculate them based on the specified clientX and clientY values. The problem is, even if I modify simulate to pass pageX and pageY values explicitly, they still come through as 0 in IE9. And these values (not clientX and clientY) are the ones the mouse plugin depends on.

Changed December 05, 2011 12:34PM UTC by nickolay8 comment:4

Anyone have an idea how to deal with this bug? Having exactly this problem as described with "pageX/Y"

Changed December 08, 2011 11:41AM UTC by juancar74 comment:5

Me too, pageX and pageY coming through as 0 !

Changed January 12, 2012 02:00PM UTC by Scott González comment:6

resolution: → fixed
status: assignedclosed

Simulate: Define getters for pageX and pageY in mouse events if they come through as 0. Fixes #7324 - simulate mouse events broken for IE 9.

Changeset: e2d9b02c56ee92fa92913b451598b59a385db609

Changed January 12, 2012 02:07PM UTC by Scott González comment:7

Simulate: Define getters for pageX and pageY in mouse events if they come through as 0. Fixes #7324 - simulate mouse events broken for IE 9.

(cherry picked from commit e2d9b02c56ee92fa92913b451598b59a385db609)

Changeset: 0b7155f92781c59b0eb0ac8e008715d8a56671fb

Changed January 12, 2012 02:07PM UTC by scottgonzalez comment:8

milestone: 1.91.8.18