You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Rob Berens <rb...@osirion.nl> on 2006/12/17 19:06:15 UTC

Still open Issue 1811: Load scripts from within java script function

Could someone please have a look at COCOON-1811 and apply the patch before building 2.1.10.

Some additional background:

Currently it is impossible to use cocoon.load from within a function of another java script during handing of a sitemap call to a function:

loadingFunction = function() {
 ...
 cocoon.load("scriptToBeLoaded.js");
...
}

fails in almost every situation. The reason is that global variable scope is locked as soon as all initial scripts have been loaded in order to avoid creating new variables in global scope that migth override earlier variables with the same name.
In the current version there is an exception for Java classes so that one can still do importClass or a fully qualified new from within functions. 
As java script functions can more or less behave like classes, we also need this exception for java ascript functions. Therefore in the patch I supplied I made the test less restrictive in the respect that it also accepts new javascript functions in global scope.

I have been using this patched version in our software for over a year now and never encountered any problem.

Thanks in advance to anyone who will have a look and possibly apply the patch.

Rob Berens