I kinda used the term js file a bit too loosely. It is true that each page would likely have different functions there and even the same page on subsequent load would have different content so the file can not really be cached.
I'm thinking that instead of: <button onclick="liftAjax.lift_ajaxHandler ('F1029758482780OTA=true',null, null, null); return false;">Press me</ button> We could have: <button onclick="liftAjax('F1029758482780OTA')">Press me</button> ... .. and at the end of the page: <script type="text/javascript"> function liftAjax(id) { liftAjax.lift_ajaxHandler(id + '=true',null, null, null); return false; } ... </script> Likely there will be more synthetic functions that would need to be generated depending on specific cases. This approach would result in a slightly larger markup but I'm not sure if the impact is negligible or not. In essence we are replacing a function call with another one more concise which helps just in having a more concise function calls in the markup. BUT most likely for functions like liftAjax above we should put them in liftAjax.js that lift generates and those would just be helper function. This means that the script block above will not be needed anymore. Thoughts? Thanks Xavi for the good points. Br's, Marius On Sep 13, 7:03 pm, Xavi Ramirez <xavi....@gmail.com> wrote: > If I understand everything correctly, the proposal is to dynamically > create a js file for each page request to add event handlers? > > If this is true, then I'm against the proposal for the following two reasons: > > 1. Every page will load slower > > Since the js file is dynamically create on each request, the js file > will be un-cacheable. This means the browser be will forced to make > an addition HTTP request to the server to render each page. This adds > roughly 150ms to the page load time (50ms to 200ms for network lag, > 50ms for download, 10ms for js execution). > > 2. Each page will be more fragile > > Requiring the synthetic js file will add another point of failure. > Even now-a-days with the ubiquity of broadband, connects still get > lost and files still get corrupted. > > It's true that most modern web pages already depend a number of > external JS and CSS files, but typically these files are static and > easily cached. > > Just adding my 2 cents. > > -Xavi > > On Sun, Sep 13, 2009 at 5:41 PM, marius d. <marius.dan...@gmail.com> wrote: > > > I think so too. Does anyone have an opinion against this? I'll > > probably have some time this week or next weekend to work on it. > > > Br's, > > Marius > > > On Sep 13, 2:59 pm, Timothy Perrett <timo...@getintheloop.eu> wrote: > >> A synthetic file sounds good to me and would probably be preferable. > > >> Cheers, Tim > > >> On 13 Sep 2009, at 20:31, marius d. wrote: > > >> > That looks a little cleaner but we'll have to look more into it if > >> > we'd want to go on this path. Perhaps accumulate those function into > >> > synthetic js file .. we'll see --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---