Apprendre jQuery, bonnes pratiques

jQuery Performance Rules

  1. Always Descend From an #id
  2. Use Tags Before Classes
  3. Cache jQuery Objects
  4. Harness the Power of Chaining
  5. Use Sub-queries
  6. Limit Direct DOM Manipulation
  7. Leverage Event Delegation (a.k.a. Bubbling)
  8. Eliminate Query Waste
  9. Defer to $(window).load
  10. Compress Your JS
  11. Learn the Library
  12. Avoid use of string concat(), Use join() for the long strings.
  13. Use Latest jQuery versions with CDN hosted files instead of older version.
  14. Use of For loop instead of jQuery $.each loop.
  15. Check if an Element Exists before doing operations on the DOM elements.
  16. Always use Return False in functions.
  17. Use of HTML5 Data Attributes.
  18.  Identify weight of the page.
  19. Keep your code DRY (Don’t Repeat Yourself)

Boilerplates, starter kits

Autre (n’a peut-être pas sa place dans ce billet…)