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

Offset does not support "accounting for body margins/borders/padding": unclear what "accounting for" means #340

Open
teo1978 opened this issue Jul 13, 2013 · 4 comments

Comments

@teo1978
Copy link

teo1978 commented Jul 13, 2013

Regarding .offset()

http://api.jquery.com/offset/

"Note: jQuery does not support [...] accounting for borders, margins, or padding set on the body element."

It's not clear what "accounting for" means.
Does it mean that the offset is computed relative to the whole body including the body's margins? Or does it mean the opposite, that it is relative to the inner box of the body?

@scottgonzalez
Copy link
Member

I believe it means that if you do any of that, the results may be wrong and inconsistent across browsers. @dmethvin Can you verify?

@teo1978
Copy link
Author

teo1978 commented Jul 13, 2013

Oh, that would be awful. Not being able to compute offsets of anything if the body has padding would be an unacceptable limitation

@dmethvin
Copy link
Member

I believe we removed these limitations in 1.9, so the docs need to be changed (after re-verifying we got it right).

http://bugs.jquery.com/ticket/11542

jquery/jquery#899

@matteosistisette can you check that the body is being handled the way you expect?

@bcaudan
Copy link

bcaudan commented Feb 9, 2015

Body margins seems to be accounting by offset:
http://jsfiddle.net/xrdfo0h8/

Is there some edge cases or can this note be removed from the api?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants