-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IE8: prototyping array results in problems elsewhere #45
Comments
Using a very simple non native I'll try later to also avoid changing prototypes for |
I have some free time now so I think I'll redo all of those methods myself if you haven't already started. |
I've made the changes in a new branch. Could you try this version to check if the issue you were having is fixed: https://rawgit.com/taye/interact.js/dont-modify-native-prototypes/interact.js? Edit: corrected the URL |
Hi, Thanks for the fix. Sorry for slow response, gonna test it this afternoon. |
There is still a problem when a string is fed to the isElement function. I've changed the first comparison which fixes it. function isElement (o) {
return (typeof o === 'object') && (
typeof Element === "object" ? o instanceof Element : //DOM2
o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName==="string"
);
} |
I've added your change. Can you confirm that it works correctly? https://rawgit.com/taye/interact.js/dont-modify-native-prototypes/interact.js |
Yes, it's fixed, thanks! |
Awesome. Thanks for reporting the issue. |
The IE8 only array prototype addition causes all arrays to have a new member in IE8, the indexof function.
When iterating through arrays elsewhere in my javascript applications, it can break, because the code never expects there to be properties that aren't the array's own properties. There would need to be a manual hasOwnProperty check everywhere to fix this.
I think interact.js shouldn't do these kind of manupilations to native types, even if it's just to make things in IE8 work. Better drop IE8 compatibility if it's hard to support it IMO.
I fixed it by calling a local indexof function and replacting all calls to .indexof to use this local one. Not a great solution as well, but at least it's predictable. I could do a pull request if you're ok with using a none native function for all browsers.
The text was updated successfully, but these errors were encountered: