api.jquery.com
api.jquery.com copied to clipboard
Offset does not support "accounting for body margins/borders/padding": unclear what "accounting for" means
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?
I believe it means that if you do any of that, the results may be wrong and inconsistent across browsers. @dmethvin Can you verify?
Oh, that would be awful. Not being able to compute offsets of anything if the body has padding would be an unacceptable limitation
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
https://github.com/jquery/jquery/pull/899
@matteosistisette can you check that the body is being handled the way you expect?
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?