Jörn Zaefferer schrieb:

Hi folks,

I'm trying to solve a severe performance issue I'm experiencing in an enviroment that heavily uses incremental page rendering. I have several parts on one page that are basically independent, but to apply any JavaScript to one of those parts (actually jsr168 portlets on a websphere portal) I currently rely on jQuery's DOM ready event, which is simply too late, causing ugly rendering issues.

Now I stumbled about this blog entry by Ben Nadel: http://www.bennadel.com/index.cfm?dax=blog:583.view Basically he shows that you can apply certain scripts much faster by simply putting the necessary code after the elements the scripts work with. That is a viable solution that could be quite helpful for my issue, but unfortuantely I can't get it to work: Well, it works in FF without any problems, but IE completely refuses to load the page at all, instead alerting me about something like "can't display this page", so quite impossible to debug.

Now I tried to seperate testing of the workaround from the actual enviroment and failed to properly simulate incremental page rendering. My attempts to delay rendering of parts of a page using PHP's sleep() or usleep() functions doesn't help at all, I simply don't get any output at all until all calls to sleep finish. And under that circumstance the put-script-behind-element works perfectly.

So, any hint on how to get one of those issues solved is highly welcome, be it executing scripts before DOM ready in IE or simulating incremental page rendering.



Jörn, I think this happens in IE if you try to manipulate the DOM while it is loading, e.g. appending elements to the body from inside the body while the DOM is not yet ready.

But I'm not sure. Some things in IE are totally not deterministic.

I once needn't to start manipulation as early as can be, so I created a "listener", e.g. a timeout, to check for the element in question and give up after a certain amount of tries (just to not end up in an endless recursion). Maybe another idea for you?



-- Klaus

Reply via email to