I don`t know so much if this is a bug. It is one of those things that makes sense the way it works but introduces some subtle issues into ones application.
When working with jQuery like the example suggests this pops up so it is worth noting in the docs. Objects jQuery return are of the type window.Array window.Object etc and not part of the Node prototype. For example window.$.map returns something that is a window.Array and not an actual Array.
Subtle difference but it could be a while before you notice these things running around you application are not actually Arrays, Objects etc.
I bet this pops up a million more places. I have been hacking at this for a while and it even caught me off guard. Again not so much a bug just a little fact that makes bugs.
So if I am understanding this correctly, you have a jsdom window, but window.Array is undefined, so
window.$("div") instanceof window.Object
is false? Whereas
window.$("div") instanceof global.Object
If this is the exact problem, it should be easy to fix, by just hanging a few of the more obvious globals off of window.
Upon further inspection, the current behavior is correct: we can't let changes to the Node globals interfere with the changes in a given window, or even worse, let changes in one window interfere with changes in another window (which would be the case if they all shared the Node globals).
It that means "Set User-Agent" won't be fixed?
@NStal I have no idea what you are asking.