cls

returns elements that are matching the class name.

Arguments

Source


def cls(self, c):
    ret = pyNodeList()
    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:
            ret.append(node)
    if len(ret) == 1: return ret[0]
    else: return ret