PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/documentation/appframework/$.query.md

https://github.com/maoyao/appframework
Markdown | 48 lines | 27 code | 21 blank | 0 comment | 0 complexity | 21486c0377a929b8afc3d1ce96207073 MD5 | raw file
  1. #$.query(selector,[context])
  2. ```
  3. $.query - a faster alertnative to $("div");
  4. ```
  5. ##Example
  6. ```
  7. $.query(".panel");
  8. ```
  9. ##Parameters
  10. ```
  11. selector String
  12. [context] Object
  13. ```
  14. ##Returns
  15. ```
  16. Object Returns an appframework object
  17. ```
  18. ##Detail
  19. $.query(selector,[context]) is faster then using $() to find an element using a query selector.
  20. $() has a lot of logic to handle finding elements, turning arrays/objects into a collection, etc.
  21. $.query lets you jump right to the query selector engine and returns an App Framework collection. You should use this when possible.
  22. When context is passed in, it must be a DOM node to search within.
  23. ```
  24. var divs=$.query("divs");
  25. var elem=$.query("#main");
  26. var lis=$.query("li",$("#main").get(0));
  27. ```