has_cls

returns True if one or more of elements have the attribute class of the matching value.

Arguments

Source


def has_cls(self, c):
    cls_name = re.compile(c)
    for node in self:
        n = node.attr('class')
        if n is not None and cls_name.search(n) is not None:
            return True
    return False