Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can use queues when creating a large number of elements. Use requestAnimationFrame and each frame pop some elements off the queue to render them. This will help prevent the page from locking up during render events.


Also, when adding many elements (or not so many, but over and over), add them to a DocumentFragment [ http://developer.mozilla.org/en-US/docs/Web/API/DocumentFrag... ] first, and then attach that to the DOM in one piece (one big DOM update is better than many small ones).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: