Basic/Base App with Go-Macaron. With user registration/login/logout, one simple admin page and user profile edit. Taken from my git.txt to simplify laters dev app.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

50 líneas
1.7 KiB

  1. package goquery
  2. import "golang.org/x/net/html"
  3. // Is checks the current matched set of elements against a selector and
  4. // returns true if at least one of these elements matches.
  5. func (s *Selection) Is(selector string) bool {
  6. return s.IsMatcher(compileMatcher(selector))
  7. }
  8. // IsMatcher checks the current matched set of elements against a matcher and
  9. // returns true if at least one of these elements matches.
  10. func (s *Selection) IsMatcher(m Matcher) bool {
  11. if len(s.Nodes) > 0 {
  12. if len(s.Nodes) == 1 {
  13. return m.Match(s.Nodes[0])
  14. }
  15. return len(m.Filter(s.Nodes)) > 0
  16. }
  17. return false
  18. }
  19. // IsFunction checks the current matched set of elements against a predicate and
  20. // returns true if at least one of these elements matches.
  21. func (s *Selection) IsFunction(f func(int, *Selection) bool) bool {
  22. return s.FilterFunction(f).Length() > 0
  23. }
  24. // IsSelection checks the current matched set of elements against a Selection object
  25. // and returns true if at least one of these elements matches.
  26. func (s *Selection) IsSelection(sel *Selection) bool {
  27. return s.FilterSelection(sel).Length() > 0
  28. }
  29. // IsNodes checks the current matched set of elements against the specified nodes
  30. // and returns true if at least one of these elements matches.
  31. func (s *Selection) IsNodes(nodes ...*html.Node) bool {
  32. return s.FilterNodes(nodes...).Length() > 0
  33. }
  34. // Contains returns true if the specified Node is within,
  35. // at any depth, one of the nodes in the Selection object.
  36. // It is NOT inclusive, to behave like jQuery's implementation, and
  37. // unlike Javascript's .contains, so if the contained
  38. // node is itself in the selection, it returns false.
  39. func (s *Selection) Contains(n *html.Node) bool {
  40. return sliceContains(s.Nodes, n)
  41. }