Finally found a work-around: I was calling my objective-c function using window.location . It turned out if I added a setTimeout around the call to window.location everything started working again. I'm guessing calling window.location would immediately call the objective-C code, interrupting the javascript thread, leaving things in a bad state. By adding the setTimeout it allows the javascript thread to finish before jumping into the objective-C code. Or something like that.
Someday I'll have to write this up and post it somewhere... Parand http://parand.com/say/ On Mar 5, 2:07 pm, John Resig <[email protected]> wrote: > Unfortunately, I have no idea - it doesn't make it easier that it's > such a custom set up. Maybe someone with more iPhone dev experience > can speak to the situation. > > --John > > On Thu, Mar 5, 2009 at 4:52 PM, Parand <[email protected]> wrote: > > > Hello, > > > I'm having a strange issue using jQuery on UIWebComponent on the > > iPhone - at some point jQuery becomes unable to add content to the > > DOM, while regular DOM methods (document.getElementById > > ('something').appendChild(x) ) continue to work. > > > I've posted details on stackoverflow, and I'll describe them below. > > I'm hoping someone here can point me in the right direction: > > >http://stackoverflow.com/questions/591949/iphone-webkit-jquery-strang... > > > I'm doing funky things with UIWebComponent, passing control back and > > forth between objective-C and WebKit: from WebKit I invoke Objective-C > > code by calling a special URL that the Objective-C handler catches, > > and from Objective-C I execute Javascript in WebKit. Works well for > > the most part. > > > I switch "pages" by showing and hiding divs on the same html page. > > After switching a couple of times and some objC-Webkit interactions, > > jQuery becomes unable to update the dom. > > > var x = document.createTextNode('THE FIRST THING'); > > document.getElementById('thumbspage').appendChild(x); > > $('#thumbspage').append('-- THE SECOND THING'); > > > "THE FIRST THING" shows up, "THE SECOND THING" doesn't . > > > I can still hide and remove elements using jQuery, but I can't add > > anything. > > > Any ideas? > > > Best, > > > Parand > >http://parand.com/say/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" 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/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
