If anyone wishes to try to replicate the crash, you can visit a demo of the site on http://iphone2.limemedical.com.
If you click on Patient List via the landing page, click on the first 7+ patients (obviously they aren't real people) Your browser should and will crash (on the iPhone, won't on the desktop) There's nothing odd about my code that I can find. I'm having an extremely difficult time finding what's the cause of it because of lack of debugging tools on the iPhone. On 2/6/08, Steve Finkelstein <[EMAIL PROTECTED]> wrote: > Hey folks, > > I've been able to replicate a consistent crash with Mobile Safari > using 1.1.3 firmware. I'm using the cookie class written by David > Flanagan in his highly accredited JavaScript: The Definitive Guide, > code can be found here: > > http://www.davidflanagan.com/javascript5/display.php?n=19-2&f=19/Cookie.js > > I believe the code I've appended at the bottom of this email is the > culprit. I basically keep track of visited IDs of an <li> element in a > cookie. In a nutshell for those who don't feel like reading the code, > I create a cookie and set its expiration to 24 hours. In it, I have a > cookie named visited_data with a value of something like > > visited_data=visited:1|2|3|4 > > where 1,2,3,4 are the visited IDs. I have code which can arbitrarily > remove ids and add ids. However, on the iPhone .. and iPhone only > (cannot replicate on Safari3/Webkit).. if I click enough <li> > elements, about 6+, it crashes the browser. > > Does anyone have any idea what could be causing it? Is the value of > the cookie data limited in an iPhone? Is there a more elegant approach > to my solution for storing visited status on multiple elements, say > 100+ ? > > Using binary bitmasks has crossed my mind.. but I'm quite reluctant at > the moment in that approach because of readability by other > developers. > > Thanks all. > > /sf > > code: > > function _check_status(obj) { > > var evt = window.event; > var el = evt.srcElement; > > if (el.tagName == "SELECT") return; > > var pid = el.lastChild.id || el.parentNode.lastChild.id; > > // Check if patient has been visited > var cookie = new Cookie("visited_data"); > > // Check if patient has been visited. > if(cookie.visited) { > // check if particular id has been visited. > > if(!cookie.check(pid)) { > cookie.visited += "|" + pid; > cookie.store(1); > obj.className += " visited"; > > } else { > var values = cookie.visited.split("|"); > delete cookie.visited; > cookie.visited = ''; > > for(var i=0; i < values.length; i++) { > if (values[i] == pid) > continue; > else cookie.visited += "|" + values[i] ; > } > cookie.visited = cookie.visited.substring(1); > > cookie.store(1); > obj.className = "patients"; > } > > } else { > cookie.visited = pid; > cookie.store(1); > // User has NOT been visited, enable their visited > status. > obj.className += " visited"; > } > > } > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
