On Oct 29, 3:46 am, John Simons <[email protected]> wrote:
> Now a days, with libs like jQuery, we rarely(web developers) need to
> write browser specific javascript,

This part is true.  I've, in fact, never actually used that feature in
my own code. (And, You'llnote that I didn't use it in the sample I
posted above).  I was in fact considering removing or at least de-
emphasisizing it in the latest changes.   (I was planning on making an
unnamed section the same as the #all section, except nVelocity has
trouble parsing things like $("#id")  in unnamed section).

> Another point is that, my intent is to standardise only on JQuery. so
> no need to support prototype or scriptaculous.

Actually, this is where it's use shows the MOST benefit.

In what I'd originally considered to be a minor feature, but now
consider to be it's most important, is that it handles negotiating
the use of Javascript on multiple levels (Layout, View,  and
ViewComponent).   This is particularly important when dealing with
Framework or third-party ViewComponents.

Take for example the components in CastleContrib that use Javascript:
Collapsible Panel, and MoreLessText.  Both were originally written to
use Prototype, because that was the standard js library of Monorail.
After I rewrote them to use the JavascriptComponent, the developer
could now choose to use either Prototype or Jquery  (You would just
need a jslibraries.xml file with the single line <libraries
preferredLibrary="jquery" /> )  (you can also specify your choice as a
VC parameter))

Further, both of those are VCs that you are likely to have multiple
times on a page.  And originally, common JS code was repeated multiple
times.  With the JavascriptComponent, the common code is included only
once with only the instance specifc code repeated)

FInally, to use of either components, the website developer must know
that it uses a particular JS framework, and remember to include that
library manually.  With the JavascriptComponent, the VC can indicate
what libraries it needs, and they (along with their dependencies  are
automatically included).

This become particularly important when you start using jQuery UI
where each module has a list of dependencies which have to be included
in the right order, and where every jQuery plugin comes with it own
CSS file which you must remember to include.

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to