Fix instance of

instanceof doesn't work properly when objects from different documents/windows/iframes are compared.