innerHTML and Ajax – Bad Combination

Monday, January 7th, 2008

Ajax is comparatively new to the world of programming and software. So far, only few people have cracked the use of this program without the use of toolkits. Only God knows how many people who can actually code without using toolkits but I’m willing to bet that they don’t really reach that much. Saying that only a rocket scientist could figure out how to properly code Ajax is probably an understatement considering its requirements from a developer.

But if you have figured Ajax out, good for you. On my end, I was able to do a little bit of Ajax project from time to time but I still have troubles figuring things out. It’s still a matter of trial and error for me.

In my journey in figuring out Ajax, I came into contact with one of the peculiar situation that will only happen to Ajax. If you have been to the world of programming language, you may already have encountered innerHTML. This little tool is often used by programmers to easy write objects in a DIV. Although the longer way of using DOM is also good, programmers naturally select the easier way… including me.

(more…)

Popularity: 18% [?]

Why innerHTML can ruin your AJAX applications

Monday, January 7th, 2008

The reason I am writing this article is because of some work I have been doing recently. My client wants a persistent AJAX application to work in IE6+. This means the web page will be left running for days/weeks on end without being refreshed or the browser being closed. This means it cannot have ANY memory leaks.

I currently process incoming XML using an XSL document – which works very well. However when done under IE6 the XSL transformation is output as plain text [please let me know if there is a DOM alternative] which means the only way to insert my newly transformed code is to use innerHTML. This seems to leak memory like a biatch! Note that the leak doesn’t occur in FireFox.

So why does innerHTML leak? Well after some digging I found out a few interesting facts – lets look at the who, where, why and how…

(more…)

Popularity: 15% [?]

About Office-it.orG

This is a site to share my knowledge, discovery and experience related to my hobby and work. Most articles on this site are related to web design, web development, graphic design, short reviews, tips and tricks. I sometimes write some about Microsoft Office Application too.

Want to subscribe?

RSS Subscribe in a reader Or, subscribe via email:
Enter your email address:  
Find entries :