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

Wrong return value of offset method for hidden/disconnected elements #1197

Open
fmeyertoens opened this issue Nov 4, 2021 · 0 comments
Open

Comments

@fmeyertoens
Copy link

The jQuery docs state, that

While it is possible to get the coordinates of elements with visibility:hidden set, display:none is excluded from the rendering tree and thus has a position that is undefined.

The return value of undefined was changed a few years ago in jquery/jquery#2396 due to jquery/jquery#2310. The tests are here.
Now a value of { top: 0, left: 0 } is returned instead (https://github.com/jquery/jquery/blob/a684e6ba836f7c553968d7d026ed7941e1a612d8/src/offset.js#L88)
and undefined is only returned for an empty jQuery object (https://github.com/jquery/jquery/blob/a684e6ba836f7c553968d7d026ed7941e1a612d8/src/offset.js#L79).

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

No branches or pull requests

1 participant