Re: [csswg-drafts] It is unclear when offsetX/Y are calculated

Specifically, consider the behavior of these three testcases in the 
various browsers:

First:

    <div style="position: relative" id="mydiv">
      Click on the "C" of the first "Click" in this line
    </div>
    <script>
    document.getElementById("mydiv").onclick = function(e) {
      console.log(e.offsetX);
      document.querySelector("div").style.left = "200px";
      console.log(e.offsetX);
    };
    </script>

For this testcase, Gecko reports a number near 0, then a number near 
-200.  Blink/WebKit report a number near 0 twice.  Edge 14 matches 
WebKit/Blink.  Live version at https://jsfiddle.net/7x5e701m/1/

Second:

    <div style="position: relative" id="mydiv">Click on the "C" of the
 first "Click" in this line</div>
    <script>
    document.getElementById("mydiv").onclick = function(e) {
      document.querySelector("div").style.left = "200px";
      console.log(e.offsetX);
    };
    </script>

For this testcase, both Gecko and Blink/WebKit report a single number 
near -200.  Edge reports a number near 0.  Live version at 
https://jsfiddle.net/7x5e701m/2/

Third:

    <div style="position: relative" id="mydiv">
      Click on the "C" of the first "Click" in this line
    </div>
    <script>
    document.getElementById("mydiv").onclick = function(e) {
      var d = document.querySelector("div");
      d.style.left = "200px";
      console.log(d.offsetLeft)
      console.log(e.offsetX);
    };
    </script>

For this testcase, both Gecko and Blink/WebKit report a number near 
200, then a number near -200.  Edge reports a number near 200, then a 
number near 0.  Live version at https://jsfiddle.net/7x5e701m/4/

-- 
GitHub Notification of comment by bzbarsky
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/1070#issuecomment-283341492
 using your GitHub account

Received on Wednesday, 1 March 2017 13:37:56 UTC