|
Modern web pages often use Javascript, a language that is executed by browsers and provides almost unlimited possibilities when manipulating web pages.
If you are developing a website there's a good chance that sooner rather than later you will want to use javascript to produce a special effect or maybe refresh just part of the page without loading the whole page.
Writing javascript is specialised, there are many things that are done over and over, so it's not surprising that libraries have been written to help javascript programmers. These libraries let programmers write less code but do more, the most well-known are MooTools, Prototype and jQuery.
All three originated in 2006 MooTools as a set of tools using the Prototype javascript library, and jQuery as another library. Each has its strengths and adherents, as with much in the computer world there is fierce argument between proponents of one library when confronted by users of other libraries. Usually there is truth on both sides but it is rare that there is a consensus as to which is really best, and then arguments about what 'best' means start to come into play.
For better or for worse, the designers of Joomla decided to use MooTools, which means that the MooTools library is essential for the running of Joomla.
In March 2008, MooTools was used by about 8% of javascript developers while Prototype and jQuery were used by about 18% each.
There is only one way to decide which javascript library suits you best, you have to get your hands dirty by writing some code! Only then can you decide which set of features you prefer. The author started writing javascript without a library, then discovered Prototype, used that for a while but found the documentation too concerned with the inner workings of Prototype than getting results. On another project, with great reluctance, jQuery was used by necessity and that was a turning point. The syntax was easier to understand, the documentation, especially the demo sites were easy to follow so the switch was made. Since then there has been no going back.
When using Joomla that presents a problem, Joomla loads MooTools which means that in javascript the $ function will use the MooTools function, not the jQuery function. Fortunately jQuery has a 'no conflict' way of working, which means that the two libraries can co-exist. Using jQuery with Joomla is straightforward once you know how to do it, but finding out was a difficult and frustrating process, that's why this article was written, to help other developers share the experience and show how the issues have been resolved.
|