RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.39k stars 2.17k forks source link

IE8 error: Object doesn't support this property or method #1217

Open sergiocormio opened 8 years ago

sergiocormio commented 8 years ago

jquery.inputmask.bundle.js Version: 3.2.8-17 Line: 852 Char: 21

I think the problem is because IE8 doesn't support getPrototypeOf method [(http://stackoverflow.com/questions/10919915/ie8-getprototypeof-method)]

Regards, Sergio

SimenB commented 8 years ago

I'm still getting an error in IE8 (9 and above works fine) from the lines changed in the linked commit.

Callstack is maskScope->mask->patchValueProperty

Errors on the line var valueProperty = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt), "value") : void 0;

Error thrown is Object expected

We have core-js installed (shims es5 and some es6), so the check returns true.

It works fine in 3.2.7 though, just 3.3.0 that throws

RobinHerbots commented 8 years ago

@SimenB ,

Can you retry with the version from github?

RobinHerbots commented 8 years ago

@SimenB ,

Sorry, I didn't read your comment thoroughly. Which of the 2 is failing exactly? getOwnPropertyDescriptor or getPrototypeOf. Is it related to the shim?

SimenB commented 8 years ago

I can check later. I think it's related to the shim, as you check if the function exists, and it does, but it doesn't work properly

SimenB commented 8 years ago

getOwnPropertyDescriptor is the problem

SimenB commented 8 years ago

You can't use getters and setters in IE8. You should check if it works, not if the methods to use them exists. See my PR to webpack for sample: webpack/webpack#2087

RobinHerbots commented 8 years ago

@SimenB ,

Hmm, without corejs the valuepatching passes without problem, although it also calls the getOwnPropertyDescriptor fn. See latest version on github.

SimenB commented 8 years ago

I'll try HEAD now

SimenB commented 8 years ago

Now it fails on var valueProperty = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt), "value") : undefined;, so same line, I suppose.

Are you able to run it in IE8 if you include core-js/es5 first? IE9 is not a problem

RobinHerbots commented 8 years ago

@SimenB ,

No without core-js, it runs and patches the value

I guess the getPrototypeOf fn gives different result