Skip to content

Commit

Permalink
manually merging Aaron's getOffsets IE fix, whitespace fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tomocchino authored and kassens committed Oct 6, 2008
1 parent 61c4442 commit fead0b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Source/Element/Element.Dimensions.js
Expand Up @@ -60,6 +60,14 @@ Element.implement({
},

getOffsets: function(){
if (Browser.Engine.trident){
var bound = this.getBoundingClientRect(), html = this.getDocument().documentElement;
return {
x: bound.left + html.scrollLeft - html.clientLeft,
y: bound.top + html.scrollTop - html.clientTop
};
}

var element = this, position = {x: 0, y: 0};
if (isBody(this)) return position;

Expand All @@ -77,15 +85,12 @@ Element.implement({
position.x += leftBorder(parent);
position.y += topBorder(parent);
}
} else if (element != this && (Browser.Engine.trident || Browser.Engine.webkit)){
} else if (element != this && Browser.Engine.webkit){
position.x += leftBorder(element);
position.y += topBorder(element);
}

element = element.offsetParent;
if (Browser.Engine.trident){
while (element && !element.currentStyle.hasLayout) element = element.offsetParent;
}
}
if (Browser.Engine.gecko && !borderBox(this)){
position.x -= leftBorder(this);
Expand Down
2 changes: 2 additions & 0 deletions Source/Fx/Fx.Transitions.js
Expand Up @@ -10,6 +10,7 @@ Credits:
*/

Fx.implement({

getTransition: function(){
var trans = this.options.transition || Fx.Transitions.Sine.easeInOut;
if (typeof trans == 'string'){
Expand All @@ -19,6 +20,7 @@ Fx.implement({
}
return trans;
}

});

Fx.Transition = function(transition, params){
Expand Down

3 comments on commit fead0b5

@alcohol
Copy link
Contributor

@alcohol alcohol commented on fead0b5 Nov 6, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is NOT a fix. It actually breaks getOffsets for IE when using several block level elements of equal size. When one acts as a parent with style overflow:hidden and contains several children, Fx.Scroll’s method toElement() is unable to correctly find the positions of children (in IE). Reverting commited changes solves the issue.

@digitarald
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really need a functional tests, especially since we have no tests for positions at all. Just something really simple!

@xykox
Copy link

@xykox xykox commented on fead0b5 Nov 12, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it helps, I post another test case on lighthouse :
http://mootools.lighthouseapp.com/projects/2706-mootools/tickets/461-getoffsets#ticket-461-2

Please sign in to comment.