Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script error in setOffsetOption() if !offsetParent #1184

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions Source/Element/Element.Position.js
Expand Up @@ -66,12 +66,14 @@ var local = Element.Position = {

setOffsetOption: function(element, options){
var parentOffset = {x: 0, y: 0},
parentScroll = {x: 0, y: 0},
offsetParent = element.measure(function(){
return document.id(this.getOffsetParent());
}),
parentScroll = offsetParent.getScroll();
});
Copy link
Member

Choose a reason for hiding this comment

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

can we use spaces here for indentation so it lines up with the line above? /nitpick

But otherwise I like the solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With tabsize = 4 it looks right, I don't know how to fix this.

Copy link
Member

Choose a reason for hiding this comment

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

Don't use tabs here. Use tabs up to the var indentation and then use spaces from there in. Not a huge deal. If you can't figure it out or don't have time, it's ok.


if (!offsetParent || offsetParent == element.getDocument().body) return;

parentScroll = offsetParent.getScroll();
parentOffset = offsetParent.measure(function(){
var position = this.getPosition();
if (this.getStyle('position') == 'fixed'){
Expand Down