Fold All / Expand All

2011年11月23日星期三

JavaScript Patterns - Chapter 8. DOM Acess

JavaScript Patterns

DOM access is expensive; it's the most common bottleneck when it comes to JavaScript performance.

DOM access should be reduced to minimum. This means:
o Avoiding DOM access in loops
o Assigning DOM references to local variables and working with the locals
o Using selectors API where available
o Caching the length when iterating over HTML collections

0 comments: