Thanks for the answer, Chris, it was very clear, and I see this now in the Firebug console.
Nevertheless, it would be nice if the JSON reply comes with the scripts included only once... I understand that even then, the script could be already loaded (in the page request) but checked if loaded also only once after the ajax reply... that check, specially with firebug console activated, lags the app, even more if i have an animation just after the ajax reply. Regards. Chris Lewis-5 wrote: > > Hello, > > Short answers: > > 1. The behavior you're seeing is correct, you are doing nothing wrong. > 2. JS libs are only ever included once. > > Longer answer: > > Firstly, rest easy knowing that the JS libs are only included once. Even > if you see 3, 30, or 3000 ajax responses with script references, they > are only loaded once. The loading of scripts that come as part of an > ajax response is managed by tapestry.js, which checks to see if that > script has already been loaded (on the client side). > Zone responses that contain components which require external scripts > always include those script URLs in the response. Why? Because there are > cases where such components will not exist in the page until after an > ajax request - meaning they were never processed and that the original > page render lacks the needed script includes. Therefore, these > components rendered via ajax would not have their script files loaded, > and so would most likely be broken (try a test page in T5.0.13, you'll > see it). If you examine those responses more closely you'll notice > similar treatment of CSS files, because the same principle applies. > Remember that ajax requests are independent requests to the server, so > T5 has no way of knowing what scripts the browser may or may not have > already loaded. This is theoretically possible with some kind of > persistent page composition graph, but that would be complicated and > probably wasteful. Why bother the server with something that the client > can easily handle? > > Hope that clears things up. > > chris > > raulmt wrote: >> Hello, >> >> I have a zone that is updated with an ajax request. Inside this zone, I >> use >> an InPlaceEditor components (from t5components) many times (one for each >> row >> in a table). The InplaceEditor component include a javascript library, >> controls.js, with the IncludeJavascruptLibrary annotation. >> >> On the first request, this works ok, because even when the InPlaceEditor >> is >> used many times, control.js is included just once. But when I update this >> zone element and many other InPlaceEditor's arrived, this request comes >> with >> many requests for including control.js. The JSON response when I update >> the >> zone is something like this: >> >> {"scripts":["/assets/scriptaculous/5.0.14-SNAPSHOT/controls.js","/assets/scriptaculous/5.0.14-SNAPSHOT/controls.js","/assets/scriptaculous/5.0.14-SNAPSHOT/controls.js","/assets/scriptaculous/5.0.14-SNAPSHOT/controls.js"],.... >> >> I'm doing something wrong? Or T5 doesn't check that a library is included >> more than once in ajax requests?? >> >> Regards. >> > > -- > http://thegodcode.net > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/T5---Javascript-libraries-on-ajax-requests-tp18395682p18407546.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]