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).