[jboss-user] [JBoss Portal] - Scriptaculous JS files are added twice

tomstrummer do-not-reply at jboss.com
Wed Mar 26 11:46:02 EDT 2008

Scriptaculous has this handy built-in thing where it will automatically load its sub-modules (like effects.js) when you include the base scriptaculous.js.  See http://wiki.script.aculo.us/scriptaculous/show/Usage.    Unfortunately people don't realize this and add script tags for them anyway; the effect being that the libs are included twice:

This is the generated portal markup:

  | <body id="body">
  | <script src="/portal-ajax/dyna/prototype.js" type="text/javascript">
  | </script>
  | <script src="/portal-ajax/dyna/scriptaculous.js" type="text/javascript">
  | </script>
  | <script src="http://localhost:8080/portal-ajax/dyna/builder.js" type="text/javascript">
  | </script>
  | <script src="http://localhost:8080/portal-ajax/dyna/effects.js" type="text/javascript">
  | </script>
  | <script src="http://localhost:8080/portal-ajax/dyna/dragdrop.js" type="text/javascript">
  | </script>
  | <script src="http://localhost:8080/portal-ajax/dyna/controls.js" type="text/javascript">
  | </script>
  | <script src="http://localhost:8080/portal-ajax/dyna/slider.js" type="text/javascript">
  | </script>
  | <script src="/portal-ajax/dyna/effects.js" type="text/javascript">
  | </script>
  | <script src="/portal-ajax/dyna/dragdrop.js" type="text/javascript">
  | </script>
  | <script src="/portal-ajax/dyna/dyna.js" type="text/javascript">
  | ....

Note that effects, and dragdrop are there twice -- once with a relative and once with an absolute URL.  The absolute URLs are generated on the client when scriptactulous.js is sourced.  Also I'm guessing the inclusion of controls, slider and builder are unintentional??

Just to double check, I looked at FireBug's "net" console and the libs are in fact being downloaded twice by the client.

The easiest solution would be to utilize the built-in loading like so:

  | <script src="scriptaculous.js?load=effects,dragdrop" type="text/javascript"></script>
And then do not explicitly add <script.. tags for effects and dragdrop.

Environment:  JBoss Portal 2.6.4-GA on JBoss AS 4.2.2.GA

Should I file a bug report?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139025#4139025

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139025

More information about the jboss-user mailing list