[Solar-talk] using js

Rodrigo Moraes rodrigo.moraes at gmail.com
Thu Aug 30 07:52:40 CDT 2007


On 8/27/07, Jeff Surgeson wrote:
> I suppose I should only be including the scripts in the class that is using
> them as apposed to the base class, or does it matter, other than a slight
> increase in file size it should make no difference?

Hey, Jeff.
If a specific script or library is used only by a group of controllers
/ actions, you should only load them in those specific places, imo. It
depends on how often you need the library or specific modules in your
actions.

> Are there any performance issues with using 3rd party js with Solar?

Yes, sure. The user will have to load the library - only Prototype +
Scriptaculous effects will add 80kb to your page loads. After it is
loaded once, the browser will cache the scripts, but it certainly adds
some overhead anyway. For common pages, it's generally better to keep
scripts to a minimum so the page loads as fast as possible.

> I have always avoided using js but some things you just cant achieve as easily
> as with js.

Indeed.

And... hm, let me give you an suggestion. If you're inexperienced with
javascript and just need some bits here and there, I'd suggest you to
consider a more lightweight library, and increment it with more pieces
only when you need. In terms of simplicity, size and modularity, I
think there's no better candidate than jQuery. For example, you could
have a modal dialog for 30kb or less using it (21kb for the main
library + some more for the chosen modal dialog plugin). However, you
should avoid trying too much jQuery plugins [1], or you would want
them all. :)

Anyway, it's just a suggestion. :)

-- rodrigo

[1] http://docs.jquery.com/Plugins


More information about the Solar-talk mailing list