JS library for widgets (was Re: [Zope3-dev] Portlets vs Pagelets)

Gary Poster gary at zope.com
Thu Dec 9 11:11:52 EST 2004


On Dec 7, 2004, at 9:59 AM, Jim Fulton wrote:

> Garrett Smith wrote:
>
>> How does Gary handle this in his widgets that use JavaScript (or CSS
>> resources)? If we ever bring those widgets over, we'd have a 
>> first-pass
>> solution.
>
> He doesn't have a solution for this.  He has a single JS library that
> he just references from his templates.

Note that, IMO, external JS libraries are strongly preferable, both 
because of they can be more easily cached and because then you escape 
the "how am I going to escape my inline JS today" problem (admittedly 
less of a problem the more discriminating you can afford to be about 
your clients' browsers).

If you agree with this opinion, then you might start thinking about 
dynamically-generated shared JS libraries that include the widget JS 
snippets you need for some subset of forms (or pagelets, I suppose, 
from this discussion)...but then how do you define the subset?  Seems 
like unnecessary work.  I start thinking that a single non-dynamic JS 
library that your configured widgets can expect to have around is a 
pretty reasonable solution, even though it is low-tech and unsexy.

I don't think this is really pertinent to the larger issues of 
portlets/pagelets and all the other stuff that I have only followed 
vaguely, but I thought it was worth addressing this aside.

$.02 :-)

Gary



More information about the Zope3-dev mailing list