MooTools position calculation does not work correct if the element is position outside the screen if the page is centered within an document with an odd size.
The bounds in the getOffsets method are not rounded correctly.
If the offsets are absolute the rounding error does not affect the result but with a negative number the rounding error results in a wrong result.
Result should always be -250
Real calculation: 31.5-281.5 = -250
"Rounded" calculation: 31-281 = -250
Real: (-79.5)-170.5 = -250
Rounded: (-79)-170 = -249
Only affects webkit and gecko, ie and opera do not return floating point values.
See my testcase with a possible solution
With original MooTools: http://www.rrelmy.ch/mootools-position-bug/
With fixed MooTools: http://www.rrelmy.ch/mootools-position-bug/?fixed
You're right, it should simply round the value... Can you send a pull request?
fix #2434 - wrong calculation of offset
Pull request sent.
Are there any tests to verify that I did not break something else in mootools?
Yes, you could try to run the tests: https://github.com/mootools/mootools-core/tree/master/Specs#running-the-tests-in-a-browser. I'm not really sure if there are (good) tests for this specific method.
Closing this so we can discuss in the PR.