how many div's can you have before the dom slows and becomes unstable?

Slee picture Slee · May 27, 2010 · Viewed 10.2k times · Source

I am developing a jQtouch app and each request done via ajax creates a new div in the document for the loaded content. Only a single div is shown at any one time.

How many div's can I have before the app starts getting unresponsive and slow?

Anyone have any ideas on this?

EDIT: Its an iPad app running on Safari, and it would be less than 1000 div's with very basic content

Answer

Neil N picture Neil N · May 27, 2010

I've had tens of thousands, maybe even a hundred thousand divs, on screen at once. Performance is either fine, or bad, depending on:

Parsed from HTML or generated Dynamically in JavaScript?

Parsed from HTML means you have a LARGE html source, and this can make browsers hang. Generated in JS is surprisingly fast, even on Internet Explorer, which is the slowest of all browsers for JS.