> Le 17 déc. 2009 à 20:30, ltlfrari a écrit : > > >> Using iUI 0.40 dev1. >> In my app, each click of a link on a page results in a call to the >> back end server that sends a new page, complete with unique id, to the >> client. >> so, I start at screen 1, click a link, go to screen 2, click a link, >> go to screen 3 etc. Each click is adding a new page element to the >> DOM. >> When I click the back button, what happens to those DOM elements, do >> they stay in the DOM or does iUI delete them? >>
Elements loaded via AJAX are not deleted unless they are refreshed by another ajax load. When refreshed by another ajax load the old elements are replaced by the new elements -- but only if they have the same 'id' attribute. If you have a long-lived app with a lot of page-frags/views being loaded you have a potential memory problem. To avoid this you'll have to find a way to assign a unique id to each element that is loaded. If it's content from a database you could generate the id from the record id (e.g. id="widget4039") This will at least reduce the use of DOM elements to unique records. iUI could fairly easily be extended to unload DOM elements when no longer needed (or even to use them as a client side cache) If you are interested in doing that you should definitely start with the development versions of iUI 0.40. There is an event mechanism to support extensions that should make this feature fairly easy to implement. It is something I would very much like to see. If someone builds a nice extension with this feature I could easily see that feature being migrated into the core. -- Sean -- You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/iphonewebdev?hl=en.
