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:
張貼意見