I have long had this question in my mind and thought I could mention this (now that Magento team has put performance on the roadmap ). Searched around the forums for any prior discussions and found a few. But again no answers there too!! Now with the production version out I see a lot of members online and I believe it is good to discuss on why not to use JQuery instead of protoype?
I wonder if for some specific reason Magento chose to go along with prototype than JQuery.
I would be curious to see what the differences in speed would be replacing one toolkit with another. Honestly I wouldn’t think it’s that difficult per se, just a lot of replacing one function with it’s equivalent. Now I am talking mainly frontend because it seems that the backend uses it far more. I don’t know enough of the differences between the two to make an informed judgement. Some things that I wouldn’t mind knowing the differences, and wondering from people who have experienced both.
1) Cross-Browser compatibility
3) Size and speed (algorithms)
4) Ease of use (coding)
On my (relatively long) list is to do some testing with Mootools and Jquery. I personally like either of them better than Prototype, but that’s just me. Everyone is going to approach a js library from a different direction.
1) Browser compatibility isn’t usually an issue with these frameworks; they are all tested similarly. What some might handle better or differently than others are selectors. I think at this point they all sport varying degrees of pretty good DOM support.
2) Prototype + Scriptaculous, which is what Magento uses OOTB, is a combination pretty rich in features, but it’s a lot of weight to get those features, as you’ve probably noticed. Jquery comes with most of those effects by default, and there are interface plugins available to do even more. Mootools is pretty edgy, and since it’s so modular, there are a ton of effects and great features you can get with a single small download. All of them have plugins and scripts available around the web to extend them even further with modal boxes, interface tweaks, etc.
3) For overall size and speed, Mootools or Jquery easily beat out the Prototype/Scriptaculous beast. They’re a heavy duo and even Prototype’s ability to traverse the DOM seems to be much slower than the others. I believe Jquery may arguably be the fastest in that respect.
4) Usability is really going to depend on who you are and how you work. For some, Prototype’s methodology may make much more sense than the others, and the same goes for the rest. They’re all pretty similar, but my personal preference is Mootools for it’s elegance and modular nature, or Jquery for it’s speed and how easy it is to learn.
Originally prototype was choosen for it’s popularity and wealth of contributed libraries.
Few questions pop up:
Is it an established fact that jQuery is better than prototype in performance on all platforms, features and available contributions?
Is it worth dedicating resources for migration?
What about other libraries, like Dojo, YUI and MooTools?
I know a lot of people love YUI, I’ve just never been able to completely get into it, and haven’t found it to be the fastest. I haven’t had time to look into Dojo yet, but it looks to be pretty cool so far.
thanks guys!! that was a lot of useful information ....and I guess the default installation of magento will rest with the heavy Prototype+scriptaculous as the cost of migration to JQuery would be high for them. Instead I understand that preference would be given for new features ..anyway thanks for all the responses so far..
If I get a chance to look into this soon, I’ll report back. If anyone who has real js skills (unlike my own paltry experience) get a chance to dig into it sooner, I’d love to help test, regardless.
I second this. JQuery seems to be far and away the best choice out there. It’s not at all a comprehensive interface library like YUI or ExtJS. But for what it does, it’s brilliant, and surely has the largest and most active community these days. We use it for every client project possible, with the exception (regrettably) of those built on Magento.
Well, here is my experience. I tried to get rid of Prototype all together on a theme I was working on, but unsuccessful.
Even prototype itself has conflict between newest and older version. I tried implementing a prototype Accordion 2 that can show horizontal, vertical and nested accordion (couldn’t find a jQuery version for this). I got it working, but it cripples other prototype features built in Magento. The version of the prototype is the same, but the scriptaculous is .1 newer, and it also disable the ‘State/Province’ select option in the Get A Quote, Shipping and Billing Address.
I ended up making the Accordion 2 working by having the scriptaculous.js placed in the phtm file where I want the accordion be.
Anyone have any luck so far? I saw an implementation where the developer apparently could not remove prototype and so they added jquery as well. Crashed firefox 30% of the time I visited the site. Was it that difficult to pull this beast apart? Maybe that’s why varien wants $995 just to say if it is possible?
If only there was the light theme that was promised for the 1.0 release…
I am trying to use jquery but it seems to give problems with the prototype version on magento. When i add the jquery pack trough the page.xml file my send to form doesnt work anymore. is there maybe someone who knows more about this?