W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2010

MouseEvent: pageX/Y, offsetX/Y

From: Hallvord R. M. Steen <hallvord@opera.com>
Date: Fri, 02 Jul 2010 12:20:04 +0200
To: www-dom@w3.org
Message-ID: <op.ve7obqifa3v5gv@hr-opera.oslo.osa>
The MouseEvent spec covers neither event.pageX/pageY nor  
event.offsetX/offsetY. The former specifies event coordinates relative to  
top of document and the latter coordinates relative to the contents of  
nearest scrollable ancestor container.

Simulating either in JavaScript in a way that takes scrolling of any  
scrollable element into account is a bit convoluted, all the 4 major  
engines already support some of this (Gecko lacks support for  
event.offset*, IE for event.page*, Opera and WebKit supports both though  
Opera copies IE's offset* implementation more correctly for elements with  

I suggest we should include at least event.offsetX/Y in the spec.


data:text/html,<html><head><title>event properties</title></head><body><p  
style="position:fixed; left: 250px"></p><div style="height: 2000px;  
width:200px; margin: 10px; border: 10px black solid; overflow:scroll"  
'+event.clientX+'x'+event.clientY+', screen*:  
'+event.screenX+'x'+event.screenY+', offset:  
'+event.offsetX+'x'+event.offsetY+', page:  
'+event.pageX+'x'+event.pageY+', xy: '+event.x+'x'+event.y;"><p  
style="height: 3500px">Test</p></body></html>

Hallvord R. M. Steen, Core Tester, Opera Software
http://www.opera.com http://my.opera.com/hallvors/
Received on Friday, 2 July 2010 10:19:49 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:16 UTC