Bug 8128 - event.clientY is improperly implemented
Summary: event.clientY is improperly implemented
Status: VERIFIED DUPLICATE of bug 8707
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 420+
Hardware: Macintosh OS X 10.4
: P2 Normal
Assignee: Nobody
URL: http://www.gtalbot.org/DHTMLSection/W...
Depends on:
Reported: 2006-04-01 18:11 PST by Gérard Talbot
Modified: 2007-08-03 22:48 PDT (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Gérard Talbot 2006-04-01 18:11:59 PST
After a few email exchanges with Beau Hartshorne, author of the article
JavaScript Events January 18, 2006
on event properties and browser support and after checking myself in an Internet Cafe with Safari 2.02 (416.13) this page
I am convinced that Safari incorrectly implements event.clientX and event.clientY

Expected results:
event.pageY = event.clientY + [amount scrolled down from top of page]
or, in Safari,
event.pageY = event.clientY + document.body.scrollTop
event.pageY = event.clientY + window.pageYOffset
event.pageY = event.clientY + window.scrollY

DOM 2 Events defines these event.clientX and clientY as related to the client area, not related to whole document width or to whole document height.

event.clientX :
"The horizontal coordinate at which the event occurred relative to the DOM implementation's client area."

"The vertical coordinate at which the event occurred relative to the DOM implementation's client area."

Right now, there is also an unanimity of implementing event.clientX and event.clientY in Opera 7+, Mozilla 1.x, Seamonkey 1.x, Firefox 1.x and MSIE 6. Only Safari 2.x seems to take the x/y-coordinate of the (whole) document as the event.clientX/Y instead of the x/y-coordinate of the viewing area.

This bug is important to fix so that DHTML applications (relying on measurement, coordinating, positioning, etc.) can work reliably across browsers.

Peter-Paul Koch, at this precise url
also confirms the erroneous implementation of event.clientX/clientY in Safari: "Safari gives the mouse coordinates relative to the document which it also gives in pageX/Y."

I set version to 420+ since Beau Hartshorne data indicate that the incorrect implementation still exists in 417 / 420 .

I have searched for duplicates and did not find any. I set Component to JavaScript even though this bug is not a javascript engine bug; there does not seem to be any better component.
Comment 1 Gérard Talbot 2006-04-01 18:21:35 PST
It's possible that bug 6574 involves the improper implementation of event.clientY; the DHTML code (which uses a not-so-reliable browser detect code) may fork Safari into a code branch where event.clientY is used/queried.
Comment 2 David Kilzer (:ddkilzer) 2006-04-04 14:11:56 PDT
This is a known issue in Safari, confirming.

Thanks for all the great analysis, Gérard!
Comment 4 Gérard Talbot 2006-06-21 07:16:24 PDT
> This is now:
> http://www.gtalbot.org/DHTMLSection/WindowEventsNS6.html

Thanks for the correction. 

> See also Bug 8707.

In my opinion, bug 8707 is exactly the same as bug 8128.
Comment 5 David Kilzer (:ddkilzer) 2006-06-24 03:22:18 PDT
(In reply to comment #4)
> In my opinion, bug 8707 is exactly the same as bug 8128.

Marking this bug as a duplicate of Bug 8707 per reporter's comment, and since patches are being supplied to that bug.

*** This bug has been marked as a duplicate of 8707 ***