Interesting Things
- We’ve started to run across this in one of our projects: Javascript DOM methods can be a nice way to create a DOM tree (with some practice, you can write clear, reusable JS UI components), but it’s slow. You probably won’t notice it if you’re only creating a few DOM nodes, but if you’re drawing thousands of them then it can turn into a performance bottleneck. The generally-accepted solution is to push a bunch of strings into an array, use Array#join(”") to create a single string, then stick it in an element’s innerHTML. Quirksmode has some numbers and Joseph Smarr has a related presentation.