FindEach searches the html.Node and calls functions cb. Important: this method is deprecated, instead, use for .. = range Find(){}.
(top *Node, expr string, cb func(int, *Node))
| 127 | // FindEach searches the html.Node and calls functions cb. |
| 128 | // Important: this method is deprecated, instead, use for .. = range Find(){}. |
| 129 | func FindEach(top *Node, expr string, cb func(int, *Node)) { |
| 130 | for i, n := range Find(top, expr) { |
| 131 | cb(i, n) |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | // FindEachWithBreak functions the same as FindEach but allows to break the loop |
| 136 | // by returning false from the callback function `cb`. |