location is not an instance of Location

Confirmed Issue #14307901 • Assigned to Fei W.

Details

Created
Oct 19, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
  • Internet Explorer
Found in build #
41.16299
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Confusingly, while window.location reports that its constructor is window.Location, it is not an instance of window.Location.

Console session in Edge, at the msn.com start page:

window.location.proto.constructor.name
< “Location”
window.location.proto.constructor === window.Location
< true
window.location instanceof window.Location
< false
window.location instanceof window.location.proto.constructor
< false

The first two results make good sense - window.location’s constructor is called “Location” and is the window.Location object, but somehow not only is window.location not an instance of Location, but it isn’t even an instance of its own constructor.

This kind of thing can cause issues with any code that tests the type of something with instanceof in a systematic way, trying to provide typesafety when going between JavaScript and another language.

Attachments

Comments and activity

  • Apologies, > symbols didn’t render correctly, nor did __proto__, and I can’t seem to edit to correct this.

  • Microsoft Edge Team

    Changed Assigned To to “Steven K.”

  • Hi,

    No worries about the syntax rending.  I don’t know many of the rules for the markup language for this site, or I could provide advice on that.  The image is a good work around along with the console’s autocomplete feature.  :-)

    I was able to repro this.  Thank you for the submission.  Nice find.

    Steve

  • Microsoft Edge Team

    Changed Assigned To to “travil”

    Changed Assigned To from “travil” to “Fei W.”

    Changed Status to “Confirmed”

You need to sign in to your Microsoft account to add a comment.

Sign in