Skip to content

Commit

Permalink
fix #952 and #637. getScrolls was adding the element's own scroll and…
Browse files Browse the repository at this point in the history
… getOffsets was overcompensating for the error
  • Loading branch information
gonchuki authored and cpojer committed Sep 9, 2010
1 parent 303cab1 commit 6c9fda1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Source/Element/Element.Dimensions.js
Expand Up @@ -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};

This comment has been minimized.

Copy link
@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?

This comment has been minimized.

Copy link
@SunboX

SunboX Mar 23, 2011

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

This comment has been minimized.

Copy link
@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;
Expand All @@ -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
};
}

Expand Down

0 comments on commit 6c9fda1

Please sign in to comment.