W3C home > Mailing lists > Public > www-style@w3.org > February 2015

[cssom-view] behavior of MouseEvent.offsetX/Y underspecified

From: Robert O'Callahan <robert@ocallahan.org>
Date: Thu, 26 Feb 2015 15:59:29 +1300
Message-ID: <CAOp6jLY70TqSbDvRH7+wbwWKOiOH1_2R0vE85hwvPnfnkmezJQ@mail.gmail.com>
To: www-style <www-style@w3.org>, Simon Pieters <simonp@opera.com>
Two issues:

1) Need to clarify how "the origin of the padding edge of the target node"
behaves when the target node has zero or more than one CSS fragment. I
suggest using the first fragment, and returning 0 if the target node has no
CSS fragments.

2) How does this behave if element geometry changes between the event being
dispatched and "offsetX/Y" being accessed? For example, given
<div id="d" style="position:absolute; top:100px; left:100px; width:100px;
height:100px; background:yellow"></div>
<script>
d.onmousedown = function(e) {
  alert(e.offsetX + "," + e.clientX);
  d.style.top = d.style.left = "0";
  alert(e.offsetX + "," + e.clientX);
};
</script>
In Chrome, clicking in the middle of the "d" element, I observe two alerts
showing "50,150". But, if I comment out the first alert, I get an alert
showing "150,150"! So it looks like in Chrome, the first time you call
offsetX/Y it computes the offset point using the current geometry, stashes
it in the event object, and returns it unchanged afterward. This doesn't
sound like something we should spec. I'd prefer to say that it's always
computed using whatever the current CSS geometry happens to be.

Rob
-- 
oIo otoeololo oyooouo otohoaoto oaonoyooonoeo owohooo oioso oaonogoroyo
owoiotoho oao oboroootohoeoro oooro osoiosotoeoro owoiololo oboeo
osouobojoeocoto otooo ojouodogomoeonoto.o oAogoaoiono,o oaonoyooonoeo
owohooo
osoaoyoso otooo oao oboroootohoeoro oooro osoiosotoeoro,o o‘oRoaocoao,o’o
oioso
oaonosowoeoroaoboloeo otooo otohoeo ocooouoroto.o oAonodo oaonoyooonoeo
owohooo
osoaoyoso,o o‘oYooouo ofooooolo!o’o owoiololo oboeo oiono odoaonogoeoro
ooofo
otohoeo ofoioroeo ooofo ohoeololo.
Received on Thursday, 26 February 2015 02:59:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:01 UTC