apply func on each nodes
(self, func)
| 692 | return self._copy(items, parent=self) |
| 693 | |
| 694 | def each(self, func): |
| 695 | """apply func on each nodes |
| 696 | """ |
| 697 | try: |
| 698 | for i, element in enumerate(self): |
| 699 | func.__globals__['this'] = element |
| 700 | if callback(func, i, element) is False: |
| 701 | break |
| 702 | finally: |
| 703 | f_globals = func.__globals__ |
| 704 | if 'this' in f_globals: |
| 705 | del f_globals['this'] |
| 706 | return self |
| 707 | |
| 708 | def map(self, func): |
| 709 | """Returns a new PyQuery after transforming current items with func. |