Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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:


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, 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)

testMouse.html (511 bytes) - added by Kenneth G. Franqueiro 8 years ago.
page for testing several event coord properties; this can be thrown at a range of dojo versions.

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by Kenneth G. Franqueiro

Attachment: testMouse.html added

page for testing several event coord properties; this can be thrown at a range of dojo versions.

comment:1 Changed 8 years ago by Kris Zyp

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 8 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

(In [25783]) Move dojo.keys to own module, move event geometry normalization to dom-geometry (covering Opera case there too), use on.emit to publish, add multiple arg support to on.emit, remove on.publish, add support for listening to window events in two arg on(), fixes #13436, refs #12451 !strict

comment:3 Changed 8 years ago by Kenneth G. Franqueiro

(In [25784]) Fix condition for layerX/Y normalization in dom-geometry. Refs #13436

comment:4 Changed 8 years ago by Kris Zyp

(In [25785]) cleanup, layerX/Y normalization not needed dojo/on for IE since it is now in dom-geometry, refs #13436 !strict

comment:5 Changed 8 years ago by Kenneth G. Franqueiro

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 8 years ago by bill

Milestone: tbd1.7
Note: See TracTickets for help on using tickets.