#7324 closed bug (fixed)
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.
Change History (8)
comment:1 Changed 12 years ago by
comment:2 Changed 11 years ago by
Owner: | set to rdworth |
---|---|
Status: | new → assigned |
I tried your patch in Document Mode: IE9 Standards Mode and got an error "No such interface supported"
comment:3 Changed 11 years ago by
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.
comment:4 Changed 11 years ago by
Anyone have an idea how to deal with this bug? Having exactly this problem as described with "pageX/Y"
comment:6 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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
comment:7 Changed 11 years ago by
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
comment:8 Changed 11 years ago by
Milestone: | 1.9 → 1.8.18 |
---|
Created a fiddle for this: http://jsfiddle.net/BYJTp/
Javscript is the full actual jquery.simulate.js, other stuff is embedded in html.