prev_all

returns elements before this element that are in the same DOM hierarchy.

Source


def prev_all(self):
    ret = pyNodeList()
    if self.has_parent():
        brothers = self._parent.children()
        if isinstance(brothers, pyNodeList) and len(brothers) != 0:
            for bro in brothers:
                if bro.name() != 'comment':
                    if bro == self: break
                    ret.append(bro)
    if len(ret) == 1: return ret[0]
    else: return ret