I just spent almost 2 hours debugging a third party JavaScript library only to find that an array which I pass to that library gets converted to a string somewhere down the pipe… I don’t know why or how that happens, but as soon as I remove Prototype from my project, everything works fine again.
Could that be because of Prototype extending the DOM? What’s my best option? I use Prototype’s element iterators, DOM manipulation, bind() method, and string manipulators in my project, and I’d rather not lose them.
Is there a library which has all that, but which works fine with 3rd party JS libraries that are sensitive to DOM extensions?
Having worked with Prototype before in the past, there is no way to have it “play nice” (akin to jQuery’s noConflict mode).
The very approach behind Prototype prevents this. Prototype’s bread & butter comes from its Object.extend() method that gets called on objects as soon as you manipulate them with Prototype methods. Not to mention Prototype also has already modified core JavaScript objects before messing with yours.
On the other hand, jQuery is all self-contained in the jQuery object (which is, to my knowledge, all it adds to the JavaScript namespace when included).
Are there other libraries that have similar features? Sure, in fact, and I’m sure you’re sick of hearing this by now, but you could probably do most of it with jQuery. However, you won’t avoid the unavoidable: re-writing code. It won’t be done the same way with any other framework, let alone give you the same results/beahvior.
Your choices are thus: