On Sat, Jun 16, 2012 at 8:29 PM, Sergiu Dumitriu
<sergiu(a)xwiki.com> wrote:
On 06/15/2012 08:28 PM, Jerome Velociter wrote:
Hi devs,
Now that all the scripts on the Internets are implemented as jQuery
plugins, should we bite the bullet and make it easier for extensions
developers to integrate such scripts ?
Note it would not necessarily mean we use it ourselves in web/XE.
If we don't do something about it, there is the risk that many extensions
bring their own jQuery to the party, which will translate in slower page
loads and more importantly a less enjoyable extension developer
experience.
An alternative idea would be an "official" jQuery extension (with a JSX)
that other extensions can depend upon, should they need jQuery.
What do you think ?
Jerome
Using jQuery in XWiki is not a very easy task, so indeed it's a good idea
to provide our own integration known to work.
Personally I'm not a fan of jQuery, but I agree that it's the most popular
JS framework, and most JS widgets/libraries are built on top of it, so you
have my +1.
Not a huge fan either, though there are some interesting things prototype
does not have, like the "live" observers.
Packaging, I think that it should be placed on the filesystem in
resources/js/jquery/, it shouldn't be used by default, and we try to bundle
the most recent version available at the time of the release. If someone
needs a more recent version, they should update XWiki as well.
When you say bundled, you mean its script tag in the rendered pages ? Or
just present in the resources/ folder on the FS ?
When I say "bundled", I mean that it's going to be present in the
resources directory in the XE builds.
I would say, script tag included, otherwise it does
not solve much.
I'm not sure yet... On one hand I agree that it's not really going to
solve the problem if users have to use a specific jsfx call with
parameters to get it working, but on the other hand loading a pretty
significant JS library all the time just for some potential custom
extensions isn't a smart move for performance.
I would prefer a very simple mechanism to trigger the activation of
jQuery, but I can't find one simple and generic enough.
The most basic thing would be to hard-code some behavior in the JSFX
plugin implementation, so that a simple $jsfx.use('jquery') would use
the right path and the right parameters (defer=false), and make sure
that one is listed before the other extensions.