-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Ember crashes when used along with Prototype.js (or could be any third party js) #9339
Comments
Here is a fiddle working http://jsbin.com/balikequwepu/1/edit But it does appear to be a bug here where Ember.libraries.each implements its own each function, which collides with Prototype's map function which triggers I will verify in the morning. |
@jasonmit I really appreciate your effort, but i am afraid that this kind of issues might occur again. Whenever we get these type of issues, there is a need to put a patch. A better solution would be to avoid prototype.js in this case. I am not sure whether it is the only one third party js that collides with Ember. Is there any way to avoid similar issues without putting a patch ? |
Our EnumerableUtils and friends use the Array.prototype.forEach method if it's available. That helper is being used here: https://github.com/emberjs/ember.js/blob/master/packages/ember-metal/lib/libraries.js#L37 I think @jayphelps is rewriting libraries here: #9312, we could have it use a for loop instead in the meantime instead of the helpers. I'm pretty sure that wouldn't break the public API of Libraries. I think @jdalton and @stefanpenner have been talking about using our polyfills always in these helpers to avoid collisions with native methods, like forEach, contains, etc. #9269 However, I think changing the EnumerableUtils behavior would be a breaking change and one we couldn't make until we were ready to start releasing Ember 2.0. Stef could probably fill in what the plans for all the polyfill/enumerable stuff is, if the core team has talked about it already. |
This is also fixed if you use a more recent prototype version (tested with 1.7.2 and the JSBin provided works properly). |
@rwjblue : Yes, Ember is working fine with latest prototype version. But prototype breaks when it is included before Ember. @fivetanley : Thanks for the updating ongoing work on this. It is really good if we avoid collisions. |
Looks like #9312 would fix this? Let me know if I'm mistaken and I'll reopen. |
I am embedding my ember app in another environment where prototype.js is also used. I am getting errors in the console when the ember application is created (Ember.Application.create()). I read the documentation of emberjs about disabling prototype extensions (http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/ ). I have tried the steps suggested there, but the errors persists as the ember application crashes. Jsbin link http://jsbin.com/raqab/2/edit .Please suggest me a possible solution for this.
Note: This might be a repeated question. Since i am a beginner, it confuses me a lot .
The text was updated successfully, but these errors were encountered: