select_selected

returns selected elements.

Source


def select_selected(self):
    ret = pyNodeList()
    for node in self:
        if node.name() == 'option':
            s = node.attr('selected')
            if s is not None and (s.lower() == 'selected' or s == ''):
                ret.append(node)
    if len(ret) == 1: return ret[0]
    else: return ret