#13436 closed defect (fixed)
Opera: layerX and layerY not normalized for mouse events
Reported by: | Kenneth G. Franqueiro | Owned by: | Kris Zyp |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | Events | Version: | 1.7.0b1 |
Keywords: | opera mouse | Cc: | |
Blocked By: | Blocking: |
Description
Opera does not populate the layerX and layerY properties of mouse event objects, and Dojo does not normalize them.
Dojo documents that it normalizes layerX/Y (see http://dojotoolkit.org/reference-guide/quickstart/events.html#the-event-object), however it seems to have never done so for Opera - the normalization has always been buried in an IE-specific codepath (and still essentially is in trunk, being within a !has("dom-addeventlistener")
codepath). I tested as far back as Dojo 1.3 and this is the case.
The normalization code for layerX/Y is not involved; it simply involves aliasing offsetX/Y. It's interesting to note that Firefox actually doesn't set offsetX/Y, and dojo doesn't seem to normalize in that direction at all, but we also don't claim to do so in the docs. (Worth noting just so we don't accidentally clobber layerX/Y with undefined in FF when trying to fix this)
Attachments (1)
Change History (7)
Changed 11 years ago by
Attachment: | testMouse.html added |
---|
comment:1 Changed 11 years ago by
I am thinking maybe normalization of pageX/Y and layerX/Y should be implemented in dojo/dom-geometry (with a normalizeEvent function export) and used in dojo/_base/connect. I am also wishing we normalized to offsetX/Y instead of layerX/Y (isn't that a more accurate name?). Guess we could do both, and remove layerX/Y in 2.0.
comment:2 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 Changed 11 years ago by
comment:4 Changed 11 years ago by
comment:5 Changed 11 years ago by
I was actually thinking of putting the pageX/Y thing in a separate ticket but you beat me to it. :) I'd like to discuss the changes made a bit so that everyone can be on the same page.
It looks like the way the code was modified, people who load "dojo base" will continue to get the new normalization "for free" - that's great, since it means less immediate upgrade pain for them.
However, if I'm reading it right, people going baseless+AMD need to require dom-geometry
and call normalizeEvent
manually on the event object themselves, correct? (Unless they also require _base/event
) We need to make sure this gets doc'd if it is indeed the way we go, since it is quite a departure from this normalization "just working" when using dojo base. However, I realize that it keeps in line with the idea of on.js
only worrying about W3C standard properties (neither of pageX/Y nor layerX/Y are standard).
Really though, nice job reorganizing _base/event.js, it looks a lot more clearly split out now.
comment:6 Changed 11 years ago by
Milestone: | tbd → 1.7 |
---|
page for testing several event coord properties; this can be thrown at a range of dojo versions.