P
Peter Michaux
Hi,
I just did a bunch of testing and was surprised with the results. If
anyone doesn't know this stuff here is what I found about
event.clientX.
The event.clientX property in Safari is in page coordinates. In IE,
Opera, Firefox event.clientX it is in window coordinates.
This means a lot when trying to determine event location in page
coordinates. It seems best to use the old event.pageX property first if
it is a number. This works in Safari. This is how the quirksmode org
and Yahoo! UI scripts work anyway but not Flanagan's fifth edtion.
If the browser doesn't have event.pageX or it isn't a number then
hopefully we can assume that if event.clientX exists and is a number
that clientX is in window coordinates. Then add the amount of page
scroll to the clientX value to get the page coordinate.
I don't like the "assume" parts of this but maybe this is where
straight feature detection breaks down. The feature may be there but
the feature doesn't work properly. Safari has at least a few instances
of this problem.
I can imagine that we need to test that not only every feature we want
to use exists but that it works properly also. Yikes!
Peter
I just did a bunch of testing and was surprised with the results. If
anyone doesn't know this stuff here is what I found about
event.clientX.
The event.clientX property in Safari is in page coordinates. In IE,
Opera, Firefox event.clientX it is in window coordinates.
This means a lot when trying to determine event location in page
coordinates. It seems best to use the old event.pageX property first if
it is a number. This works in Safari. This is how the quirksmode org
and Yahoo! UI scripts work anyway but not Flanagan's fifth edtion.
If the browser doesn't have event.pageX or it isn't a number then
hopefully we can assume that if event.clientX exists and is a number
that clientX is in window coordinates. Then add the amount of page
scroll to the clientX value to get the page coordinate.
I don't like the "assume" parts of this but maybe this is where
straight feature detection breaks down. The feature may be there but
the feature doesn't work properly. Safari has at least a few instances
of this problem.
I can imagine that we need to test that not only every feature we want
to use exists but that it works properly also. Yikes!
Peter