orbeon/orbeon-forms — Issue #55: xxf:dynamic: clean solution for dynamic JS/CSS inclusion
Author: ebruchez
Created: 2012-03-06 01:40:53+00:00
State: open
Labels: Form Builder, RFE

See #31.

Implement a mechanism for the server to send new JavaScript/CSS to the client.

1. The server needs to know if a given piece of JavaScript/CSS has been sent already, so not to send it again if this isn't needed.
2. The Ajax response needs be able to contain either inline JavaScript (e.g. for the JavaScript included in the page for ``) and links to JavaScript files. Ditto for CSS.
3. The client-side code needs to be able to load JavaScript and CSS, both inline and by URL. We already have code doing something similar in [DeferredPortletLoader.coffee].
4. The client-side code might need to initialize the code being loaded, depending on whether listeners to YUI's [onDOMReady] and jQuery's [ready()] are called right away when the JavaScript is loaded.

[DeferredPortletLoader.coffee]: https://github.com/orbeon/orbeon-forms/blob/master/src/resources-packaged/ops/javascript/orbeon/util/DeferredPortletLoader.coffee
[onDOMReady]: http://developer.yahoo.com/yui/event/#ondomready
[ready()]: http://api.jquery.com/ready/