It seems that the correct way to do this in javascript is `event.pageX - $(element).offset().left`, where offset().left is the sum of element.offsetLeft for the element and it's chain of element.offsetParent nodes.
I've written the following decoder to pull this out (it's currently incomplete, since it doesn't deal with offsetParent yet, but I can see that it would be doable to add that).
import Json.Decode as Decode
decodeClickLocation : Decode.Decoder (Int,Int)
decodeClickLocation =
Decode.object2 (,)
(Decode.object2 (-)
(Decode.at ["pageX"] Decode.int)
(Decode.at ["target", "offsetLeft"] Decode.int)
)
(Decode.object2 (-)
(Decode.at ["pageY"] Decode.int)
(Decode.at ["target", "offsetTop"] Decode.int)
)