Object doesn't support this property or method EmberJs IE 8 issue

SharpCoder picture SharpCoder · Sep 10, 2014 · Viewed 15.3k times · Source

I am getting following error on my IE 8 page (The page is running fine in other browsers).

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3)
Timestamp: Wed, 10 Sep 2014 06:48:45 UTC

Message: Object doesn't support this property or method
Line: 70532
Char: 5
Code: 0

When I checked the line 70532 in the file mentioned, i saw this code:

if (!Object.create && !Object.create(null).hasOwnProperty) {
      throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg");
    }

What does it meant by Please polyfil with es5-sham:

 Please polyfil with es5-sham: http://git.io/yBU2rg

enter image description here

How can I fix this error.

Answer

user2844991 picture user2844991 · Sep 10, 2014

Object.create is not supported in IE8, therefore your framework is asking you to "polyfil" it, which means you need to implement something which should have been supported natively, but for some reason, this particular environment doesn't know about it.

It means, if you want to use Object.create you have to implement it yourself. Fortunatelly, you don't have to do much, the url ( https://github.com/es-shims/es5-shim/blob/master/es5-sham.js) points to a file which contains the neccesary polyfills. Just run that script before your framework script does.

update:
This line seems broken to me: !Object.create && !Object.create(null).hasOwnProperty.
If Object.create is not there, calling it like Object.create(null) should throw an error, but I think it should be something like 'undefined is not a function'.