jquery as javascript library for joomla

10 views
Skip to first unread message

niloy

unread,
Oct 20, 2010, 10:28:36 AM10/20/10
to Joomla! General Development
I have always wondered why joomla uses mootools as its default
javascript library instead of jquery. Everyone loves jquery. Wordpress
& Drupal use it. jQuery is better supported and also has its UI
library which makes it even better.

Are there any chance that Joomla will switch to jQuery as its default
library. I would love to see this change.

Davide Tampellini

unread,
Oct 20, 2010, 10:32:18 AM10/20/10
to joomla-de...@googlegroups.com
hehe... after 20 version we get joomla updated with mootools 1.2 (and now is still unusable since most extensions aren't ready for that)
maybe that will be in joomla 2.1.32 :)

2010/10/20 niloy <niloy_...@yahoo.com>

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.


Phil Snell

unread,
Oct 20, 2010, 12:19:37 PM10/20/10
to joomla-de...@googlegroups.com
will not happen, but go ahead and use jquery. you can use it in
combination with mootools in no conflict mode, or replace mootools
entirely. joomla provides options to do these things without hacking
any core code.

Brad Gies

unread,
Oct 20, 2010, 1:19:16 PM10/20/10
to joomla-de...@googlegroups.com
The best explanation I have ever heard is :

"The foundation of JQuery is to make manipulation of the Dom easier"
"The foundation of Mootools is to make Javascript more extensible"

Both have their place... but JQuery is aimed more at people that don't
want to learn to program, while Mootools is aimed at people that want to
program and want a better object oriented language.

I agree that Mootools is a little harder to learn.. but it's a much
better implementation in the long run. It's about the same question as
Windows versus Linux... Windows is dominant in the non-programmer
community for users because it's easier to learn... but Linux is much
more stable and a better tool for programmers :).


Sincerely,

Brad Gies
-----------------------------------------------------------------------
Bistro Bot - Bistro Blurb
http://bgies.com http://nocrappyapps.com
http://bistroblurb.com http://forcethetruth.com
http://ihottonight.com
-----------------------------------------------------------------------
Everything in moderation, including abstinence (paraphrased)

Every person is born with a brain... Those who use it well are the successful happy ones - Brad Gies

Adversity can make or break you... It's your choice... Choose wisely - Brad Gies

Never doubt that a small group of thoughtful, committed people can
change the world. Indeed. It is the only thing that ever has - Margaret Mead

Phil Snell

unread,
Oct 20, 2010, 1:31:01 PM10/20/10
to joomla-de...@googlegroups.com
to each his own. but I will say that there are some fundamentally
different ideas behind these two libraries. So it's not correct to say
programmers like mootools and non programmers like jquery.

one example. a programmer who does not want native javascript object
prototypes to be modified would choose jquery. another programmer does
want them to be modified, so chooses mootools. this is just one example.

Programmers can be both experienced, and have different choices of
style, and neither one is wrong, just different.

Matt Murphy

unread,
Oct 20, 2010, 1:43:49 PM10/20/10
to joomla-de...@googlegroups.com
Yeah, that comment was a little off.  But behind that is the goal of the Mootools developers to keep syntax as javascript-like as possible.  I do not understand that to be a goal of the jQuery guys.

Matt Murphy

Matt Murphy

unread,
Oct 20, 2010, 1:44:29 PM10/20/10
to joomla-de...@googlegroups.com
"javascript like"  crappy way of putting that, but I can't think of better.

Brad Gies

unread,
Oct 20, 2010, 2:05:26 PM10/20/10
to joomla-de...@googlegroups.com
I'm not saying JQuery is not good. It's very useful, and I use it often.
BUT... it's purpose is to make manipulating the DOM easier.

Mootools allows you to extend the Javascript language and Javascript can
do a lot more than just manipulate the DOM.

So... for a framework like Joomla! that has hundreds... maybe thousands
of uses of Javascript, Mootools is a much better option because Mootools
allows you to do anything Javascript can do. For someone who is writing
a Joomla! extension and just needs to manipulate a few things in the
DOM, JQuery has some very good features, and is fast to work with.

Both are good, but Mootools is the correct choice for a framework.

Here's a link that does a much better job of explaining it than I do :).

http://www.jqueryvsmootools.com/


Sincerely,

Brad Gies
-----------------------------------------------------------------------
Bistro Bot - Bistro Blurb
http://bgies.com http://nocrappyapps.com
http://bistroblurb.com http://forcethetruth.com
http://ihottonight.com
-----------------------------------------------------------------------
Everything in moderation, including abstinence (paraphrased)

Every person is born with a brain... Those who use it well are the successful happy ones - Brad Gies

Adversity can make or break you... It's your choice... Choose wisely - Brad Gies

Never doubt that a small group of thoughtful, committed people can
change the world. Indeed. It is the only thing that ever has - Margaret Mead

Matt Murphy

unread,
Oct 20, 2010, 7:15:30 PM10/20/10
to joomla-de...@googlegroups.com
"Mootools allows you to extend the Javascript language"  Actually, that puts it rather well.  It  intends to extend.

niloy

unread,
Oct 21, 2010, 12:09:26 AM10/21/10
to Joomla! General Development
To all those people who say mootools extends javascript...
Well, maybe it does and jQuery doesnt. So what? Does it matter to web
developers? Web developers dont write entire javascript applications.
Joomla is a web developer tool to make cool websites. Lets just focus
on web development, shall we. And as a web developer, manuipulating
the DOM is 80% of the javascript work. 20% is the non-DOM work, but I
find the native javascript more than enough. jQuery makes 80% of the
javascript work a breeeeze which makes it totally worth it as the
default library.
Moreover, I really dont see Mootools currently being used to extend
javascript in Joomla. Afaik, its being used for the drop down menu &
accordian effect in the back end. Please, lets just be practical and
concentrate on whats really important.
> > joomla-dev-gene...@googlegroups.com<joomla-dev-general%2Bunsu...@googlegroups.com>
> > .

Phil Snell

unread,
Oct 21, 2010, 12:35:14 AM10/21/10
to joomla-de...@googlegroups.com
So are we now voting for whether jquery should replace mootools in
joomla? I can tell you how that vote ends. Mootools remains in
joomla. Jquery users complain, and then learn to live with it.

But maybe I'm just jaded :P


--
Phil Snell
Web Designer and Developer
Joomla! CMS Solutions Specialist
Snellcode LLC
Skype: philippe.snell
Mobile: 513-709-4014
www.snellcode.com

Andrew Eddie

unread,
Oct 21, 2010, 12:48:33 AM10/21/10
to joomla-de...@googlegroups.com
Um, actually, it's being used for a lot more than just the menu.

Let me say something. Joomla is not going to change it's core
javascript framework. However, we do make every effort to use it in
such a way as to play nice with the other frameworks/libraries in so
much as they do it in return.

There is nothing preventing anyone from use JQuery, YUI, et al in
their extensions BUT you will pay a price for not standardising on
Mootools (ignore that statement at your peril). Currently all the
developers that standardise on Mootools know, with confidence, that
their stuff is going to work on the shipped libraries and they will
get support from the project to fix problems. The "mess" that many
people find themselves with when developers don't standardise is that
component A uses one version of jQuery, module B uses another version,
and so on it goes, the end of which is a downward spiral of
incompatibility. Now, like I said, I've got nothing against anyone
used jQuery or the others, but for goodness sake those that do, get
your collective acts together and standardise versions of the *same*
framework so they all play nicely. Here's a classic case of why this
is a problem:

http://www.kunena.com/blog/19-developer-blog/68-mootools-and-kunena-16

In the end, the argument is not about Mootools vs jQuery, the argument
is about what happens when Joe Blogs wants to use something different
from "the standard". It's immaterial whether you agree with "the
standard".

Regards,
Andrew Eddie
http://www.theartofjoomla.com - the art of becoming a Joomla developer

> To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.

Phil Snell

unread,
Oct 21, 2010, 1:21:23 AM10/21/10
to joomla-de...@googlegroups.com
I agree with this, and as someone who likes jquery and joomla, I have
had to deal with these issues a lot.

The desire of many to use jquery should be understandable to anyone.
It's by far the most popular javascript library. like it or not, that's
the world we live in. So nobody should be surprised that there's a
desire to use jquery. YUI, sure it's great too, and many other
libraries.. but it's not quite the same issue.. jquery is clearly the
elephant in the room.

But just the fact that its popular doesnt mean joomla should switch to
it. And clearly we know from many many discussions, joomla will not
switch from it. So instead, those who want to use jquery should work on
finding the best and safest way to do that within that context.
Especially extension developers. It's one thing if it's your own site,
and you can tweak things just the way you want. It's very different
when a user installs your jquery based code, and it breaks against
mootools, or creates duplicate loading of jquery. That's the fault of
the extension developer, and your users deserve better than that.

No matter which library, it's very important to load the library in a
standard way. having several different extensions loading jquery is a
pain. it should be loaded once, and then there should be a standard way
to check that it is loaded. Thats how joomla loads mootools. It loads
it once in a standard way, not many times per module, component, plugin,
etc...

I suggest one system plugin to load jquery, and set a flag to say it's
loaded. Like $app->set('jqueryloaded', true); and then anyone could
check that standardized flag to know if jquery is already there. It's
these kind of constructive steps that the jquery people within the
joomla community should be doing. The code itself is fairly simple.
But it's not as much about the code as the developers being able to
cooperate, and agree to using one standard.

Phil

Christopher Reimer

unread,
Oct 21, 2010, 1:21:56 AM10/21/10
to joomla-de...@googlegroups.com
I re-read the Kunena article and realized that I needed to enable the mootools upgrade plugin to fix a minor problem that I noticed with my own Kunena forum. Now I'm confused about this. Does this mean if I create an extension for 1.5 using mootools 1.2.5, I need to advise the end user that they have to enable the plugin for my extension to work?

I've started looking to mootools for the first time. Version 1.2.5 is still available for download but version 1.3 is the current version. Would there be a problem if I learn and/or use the current version of mootools?

elin

unread,
Oct 24, 2010, 4:17:19 PM10/24/10
to Joomla! General Development
There is currently a patch in the tracker for MooTools 1.3 to go into
1.6. I know Ian is looking for testers, so if 1.3 is what you want I
encourage you to get in there and help make sure it is working as
expected.

Elin
> >http://www.theartofjoomla.com- the art of becoming a Joomla developer
> >>>> joomla-dev-gene...@googlegroups.com<joomla-dev-general%2Bunsubs cr...@googlegroups.com>
> >>>> .
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/joomla-dev-general?hl=en-GB.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
> >> To post to this group, send an email to joomla-de...@googlegroups.com.
> >> To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
> >> For more options, visit this group athttp://groups.google.com/group/joomla-dev-general?hl=en-GB.

Matt Thomson

unread,
Oct 24, 2010, 6:55:31 PM10/24/10
to Joomla! General Development
As long as different javascript libraries are used, I find it hard to
see any way out of the current mess that happens when there are 5
extensions on one page, and 2 or 3 different javascript libraries.

When I started my jed listed extension, there was no question about
what javascript library to use. It's not about whether I like jquery
or mootools better. It's about the fact that if all us developers
choose our own favourite library, we will have different preferences,
and the current problems will happen.

Therefore us all using the library that comes with Joomla, is always
better then the downsides of joomla choosing mootools, or the
downsides of joomla choosing jquery.

I don't agree with the idea of shipping jquery with Joomla as well, as
it might solve the different jquery versions issue, but it encourages
developers to go down the path of choosing their own library, rather
than going through the small work to learn to use mootools api instead
of jqueries.

If an extension developer simply bundles a premade jquery script with
jquery, rather than learning how to programme in mootools, it is
questionable whether the Joomla community should be encouraging these
extensions (although at the end of the day it is the developers
choice).

Perhaps the JED should have a box you have to tick that says "This
extension uses a javascript library that may be incompatible with
Joomla's standard javascript procedures" (not exact wording, general
idea).
> > >http://www.theartofjoomla.com-the art of becoming a Joomla developer

Phil Snell

unread,
Oct 24, 2010, 7:30:58 PM10/24/10
to joomla-de...@googlegroups.com
I don't see tons of people asking for prototype, yui, dojo etc.. You are taking about libraries as if everything is equal.  With jquery being so much more popular than other libraries, this is the reason we see this topic come up.  It's not because people don't want to use mootools, it's because mootools is the alternative library, and jquery is the dominant one. 

Remember, joomla can choose what library it uses for it's core functionality, but it can't choose what library designers and developers will use.  Nor should it.  If people want to use jquery, why should we go out of our way to make that any more difficult?  They have enough to worry about, they don't need more obstacles put in the way.

I think extensions that use jquery should make that very obvious.  They should make sure people know what they are getting.  They should also make sure they load jquery in a compatible way.  They should provide a means to disable loading of jquery, so that the user can load it via the template or a system plugin.  Hopefully developers can come to use one standardized jquery system plugin, and that will help keep things cleaner.

There is no reason that jquery cannot be used along with mootools if it is done right.  Also, since mootools is hardly used by default on the front end, a user can choose to have all jquery on the frontend.  It's up to the site developer if they want to go this route.  Again, it's not like some alternative, lesser known library.  It's the most widely used javascript library, and all indications I see are pointing to that continuing.  People are using it, and they are not going to stop using it just because joomla uses mootools for some backend cms functionality.

Phil

Matt Thomson

unread,
Oct 24, 2010, 9:55:41 PM10/24/10
to Joomla! General Development
I think if there was a standardised way of loading Jquery, it would
have to be a plugin
shipped with Joomla.

If an extension/template developer can not assume that a user has the
plugin installed,
they will include their library by defualt, and managing the various
extensions so they
don't include jquery, and do work with a 3rd party plugin will be
complicated.


I agree jquery is big now, but that is circumstantial. Things may be
different in the future,
jquery may conflict with mootools in the future. In the long run
there is the question of
how to ultimately solve this issue, and it seems going down the path
of trying to support
different javascript libraries in different Joomla plugins will not
be pretty.

I agree about informing users. It think it would be better for the JED
to have a mandatory
box about what javascript the extension uses.


Phil Snell

unread,
Oct 24, 2010, 11:08:40 PM10/24/10
to joomla-de...@googlegroups.com
A plugin would not need to be shipped with joomla. It would have to have
a standardized flag set to say jquery is loaded. Other extensions can
check for this signature to know if they should load jquery or not.
Other than that, the option to disable the loading of jquery per
extension will also be useful.

I know none of this matters if people use mootools. But for people that
still want to use jquery, there are some best practices that can be
adopted to make the extension compatible. So I think that this really
boils down too..

- if you want to use jquery in your extension, make sure to make that
very clear to users
- allow an option in the extension to disable the loading of jquery for
users that may load it other ways
- work towards loading jquery as a system plugin, using an application
level (JApplication) flag to say when its loaded
- work towards standardizing this flag, so that anyone who wants to load
jquery knows that this is what to look for

of course, you are right, it would be simpler if everyone used
mootools. Simpler from the point of view of joomla support, but there
are other factors that cant easily be ignored. Though I don't at all
think joomla needs to do anything officially to support jquery, I think
there are things the community can do to make it work better for users,
and let them have the choice.

Phil

Andy Nagai

unread,
Oct 24, 2010, 11:52:35 PM10/24/10
to joomla-de...@googlegroups.com
I agree with Phil. There should be some kind of jquery flag for extension developers.

One thing that is sometimes frustrating with the mootools integration with Joomla is that you cant simply start using a new version of mootools when it comes out. You need some kind of compatibility layer. Even doing this way was no guarantee it would work. We have a older version of Joomla 1.5 and could not use the new features of mootools 1.2 so we just started using jquery. At this time cannot upgrade Joomla that has that mootools upgrade plugin. This adds another javascript framework to download with alot of duplicated functionality.

I guess mootools is great for extensibility but its not very modular in Joomla.



Andrew Eddie

unread,
Oct 25, 2010, 1:07:46 AM10/25/10
to joomla-de...@googlegroups.com
Ok, so here's the deal. We can go round and round on this till the
cows come home, but it probably won't get us anywhere. The facts you
need to work with are:

1. Joomla core is standardised on Mootools.

2. Joomla will do everything in it's power to run Mootools in a
compatible mode with other libraries that do the same.

3. Extension developers can choose to standardise on Mootools or not,
but if not, the onus is on you to not break Joomla core.

4. Joomla will not be shipping with alternative javascript
libraries/frameworks in the near or distant future anymore than we'd
ship with the Zend framework, Symphony or similar to allow PHP
developers to use those in preference to the Joomla framework (even
though they are more popular than the Joomla framework ... for now).

That said, I have absolutely no problem with people collaborating
within this project to find solutions for people that want to use
jQuery should they so choose.

So, I suggest the people interested in jQuery do this:

a) Start a group on people.joomla.org to collect like minded people,
web and PHP developers and spread the word that you are trying to make
life easier for everyone that wants to use jQuery and Joomla.

b) Start an incubator project on joomlacode.org for ways to
standardise on a version of the jQuery files most likely using a
plugin.

c) Raise issues in the tracker where Joomla+Mootools does not seem to
be playing nicely in compatibility mode when both are present.

d) By all means grab some space on docs.joomla.org to tell people how
they can use jQuery "the right way" on Joomla sites.

e) Have fun while you are doing it :)

Hope this helps.

Regards,
Andrew Eddie
http://www.theartofjoomla.com - the art of becoming a Joomla developer

Joseph LeBlanc

unread,
Oct 25, 2010, 10:26:15 AM10/25/10
to joomla-de...@googlegroups.com
To add to all of this: I think we'll have a better shot of working with jQuery in Joomla 1.6. Since it will now be possible to ship libraries as extensions, we will be able to package jQuery as a Joomla library, which developers can package with their extensions. This will prevent us from having to build a system plugin that gets loaded on every page.

Discussion to continue over here:

http://people.joomla.org/groups/viewdiscussion/783-Best+practices+for+extension+developers+using+jQuery.html?groupid=445

-Joe

niloy

unread,
Oct 25, 2010, 11:06:46 AM10/25/10
to Joomla! General Development
...and I actually thought Joomla is a community driven project.
> Andrew Eddiehttp://www.theartofjoomla.com- the art of becoming a Joomla developer
>
> On 25 October 2010 13:52, Andy Nagai <andy.na...@gmail.com> wrote:
>
> > I agree with Phil. There should be some kind of jquery flag for extension
> > developers.
>
> > One thing that is sometimes frustrating with the mootools integration with
> > Joomla is that you cant simply start using a new version of mootools when it
> > comes out. You need some kind of compatibility layer. Even doing this way
> > was no guarantee it would work. We have a older version of Joomla 1.5 and
> > could not use the new features of mootools 1.2 so we just started using
> > jquery. At this time cannot upgrade Joomla that has that mootools upgrade
> > plugin. This adds another javascript framework to download with alot of
> > duplicated functionality.
>
> > I guess mootools is great for extensibility but its not very modular in
> > Joomla.
>

Andrew Eddie

unread,
Oct 25, 2010, 5:20:42 PM10/25/10
to joomla-de...@googlegroups.com
Hi Niloy

It is. I've taken an interest in helping you solve your problem given
all the other factors we need to balance in the project, given our
current standards, and also even though I don't really have a personal
interest in jQuery. I think that's fair, don't you ;)

Regards,
Andrew Eddie
http://www.theartofjoomla.com - the art of becoming a Joomla developer

elin

unread,
Oct 25, 2010, 6:47:32 PM10/25/10
to Joomla! General Development
Niloy,

Andrew, Phil and others have described for you how to work in a
community driven way to achieve your goals so I'm not sure what the
point of your comment is. Community driven means that people in the
community write (or pay someone to write) the code that scratches
their itches and when the code is good enough (and if it is
appropriate) it is added to the core or becomes a standard add on (as
Joe and Phil suggest). Thus the community drives the code in the
direction it wants to go. We in the community are fortunate to have
senior developers like Andrew to explain the issues and give advice
like he has given here and to review proposed code to ensure that it
does not cause unanticipated problems and meets the incredible demands
of the Joomla install base. We're also lucky that there are always a
lot of people willing to help each other.

I think it would be great if someone would take what Andrew wrote and
add it to the wiki as guidance for how to organize work on an issue in
a community driven way especially as we move the new development
process.

For all the talk about how much some 3pds want to use JQuery I'm
surprised that a group of them has not gotten together to agree on a
standard distribution and collaborate on or fund creation of a common
library for 1.6. Really in a way its no different thana company
wanting a driver in Linux. Linus doesn't code it for them, they code
it and if it is good enough it gets in.

Elin

On Oct 25, 5:20 pm, Andrew Eddie <mambob...@gmail.com> wrote:
> Hi Niloy
>
> It is.  I've taken an interest in helping you solve your problem given
> all the other factors we need to balance in the project, given our
> current standards, and also even though I don't really have a personal
> interest in jQuery.  I think that's fair, don't you ;)
>
> Regards,
> Andrew Eddiehttp://www.theartofjoomla.com- the art of becoming a Joomla developer
>
> >> Andrew Eddiehttp://www.theartofjoomla.com-the art of becoming a Joomla developer
Reply all
Reply to author
Forward
0 new messages