Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Why not JQuery with Magento
 
srinigenie
Guru
 
Avatar
Total Posts:  539
Joined:  2008-02-04
 

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 wink ). 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.

Pitch in with your views.

 
Magento Community Magento Community
Magento Community
Magento Community
 
srinigenie
Guru
 
Avatar
Total Posts:  539
Joined:  2008-02-04
 

Wish if someone from Magento team can share their views on this.

 
Magento Community Magento Community
Magento Community
Magento Community
 
alistek
Sr. Member
 
Total Posts:  293
Joined:  2008-04-02
Normal, IL
 

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
2) Features
3) Size and speed (algorithms)
4) Ease of use (coding)

-Adam

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sprout Collective
Member
 
Total Posts:  64
Joined:  2007-08-31
Portland, OR / Orange County, CA
 

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.

Just understand that I’m not a javascript developer by trade and this is just based on my relatively limited experience.  So, no flaming, please. wink

-Cliff

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

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?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@Sprout Collective: umm.. i guess you answered some of my questions while i was typing them smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sprout Collective
Member
 
Total Posts:  64
Joined:  2007-08-31
Portland, OR / Orange County, CA
 

Heh, just sneaky like that. smile

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.

This selector speed/validity test says a lot: http://mootools.net/slickspeed/

-Cliff

 
Magento Community Magento Community
Magento Community
Magento Community
 
srinigenie
Guru
 
Avatar
Total Posts:  539
Joined:  2008-02-04
 

thanks guys!! that was a lot of useful information smile ....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 smile ..anyway thanks for all the responses so far..

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sprout Collective
Member
 
Total Posts:  64
Joined:  2007-08-31
Portland, OR / Orange County, CA
 

I haven’t checked, but as long as there is no inline scripting that is dependent on any js framework (like onclick="...") and all of the javascript is written properly outside of the markup (where it belongs), it should be pretty strait-forward to create extensions to use Jquery or Mootools instead of Prototype.

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.

-Cliff

 
Magento Community Magento Community
Magento Community
Magento Community
 
ashanholt
Member
 
Avatar
Total Posts:  33
Joined:  2007-09-05
 

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.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

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.

 
Magento Community Magento Community
Magento Community
Magento Community
 
oshipper
Member
 
Total Posts:  53
Joined:  2008-02-04
New York, NY
 

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…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Michal_s
Sr. Member
 
Total Posts:  111
Joined:  2008-05-15
The Netherlands
 

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?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top