Permalink
Browse files

fix #952 and #637. getScrolls was adding the element's own scroll and…

… getOffsets was overcompensating for the error
  • Loading branch information...
1 parent 303cab1 commit 6c9fda19070de685ebbbe71dd2128fe28f13f6ee @gonchuki gonchuki committed with cpojer Sep 9, 2010
Showing with 3 additions and 4 deletions.
  1. +3 −4 Source/Element/Element.Dimensions.js
@@ -48,7 +48,7 @@ Element.implement({
},
getScrolls: function(){
- var element = this, position = {x: 0, y: 0};
+ var element = this.parentNode, position = {x: 0, y: 0};
@stroborobo
stroborobo Mar 23, 2011

This is a serious fix, once again undocumented. Why was there no changelog from 1.2 to 1.3, which describes this change?

@SunboX
SunboX Mar 23, 2011

Changelog is above: fix #952 and #637 - where´s the prob?

@stroborobo
stroborobo Mar 23, 2011

Well, I wasn't talking about the log that came with the commit, look at this one:
https://github.com/mootools/mootools-core/wiki/Changelog

"1.2 => 1.3" is missing. Recently I updated mootools in our project and went through the two documents in mootools' wiki on github "Update/Upgrade from 1.2 to 1.3". Functions, that behave different from now on, are not listet there. I don't think that anyone, who is not into mootools development, can keep track of all the commit logs, it is just far too verbose, I want to know what has changed in using mootools, not how it was changed internally.

I am debugging my code for almost two and a half days now and nearly every search ended in a mootools file. I don't say these are all bugs in mootools, this commit for example is a bugfix, definitely, but it completely changed the function's return values and with that the return values of Element.getPosition().

while (element && !isBody(element)){
position.x += element.scrollLeft;
position.y += element.scrollTop;
@@ -73,12 +73,11 @@ Element.implement({
html = document.id(this.getDocument().documentElement),
htmlScroll = html.getScroll(),
elemScrolls = this.getScrolls(),
- elemScroll = this.getScroll(),
isFixed = (styleString(this, 'position') == 'fixed');
return {
- x: bound.left.toInt() + elemScrolls.x - elemScroll.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft,
- y: bound.top.toInt() + elemScrolls.y - elemScroll.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop
+ x: bound.left.toInt() + elemScrolls.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft,
+ y: bound.top.toInt() + elemScrolls.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop
};
}

0 comments on commit 6c9fda1

Please sign in to comment.