Return all labels (Label instances) for this item. For items that represent radio buttons or checkboxes, if the item was surrounded by a tag, that will be the first label; all other labels, connected by 'for' and 'id', are in the order that appear in the HTML
(self)
| 1634 | control.items.append(self) |
| 1635 | |
| 1636 | def get_labels(self): |
| 1637 | """Return all labels (Label instances) for this item. |
| 1638 | |
| 1639 | For items that represent radio buttons or checkboxes, if the item was |
| 1640 | surrounded by a <label> tag, that will be the first label; all other |
| 1641 | labels, connected by 'for' and 'id', are in the order that appear in |
| 1642 | the HTML. |
| 1643 | |
| 1644 | For items that represent select options, if the option had a label |
| 1645 | attribute, that will be the first label. If the option has contents |
| 1646 | (text within the option tags) and it is not the same as the label |
| 1647 | attribute (if any), that will be a label. There is nothing in the |
| 1648 | spec to my knowledge that makes an option with an id unable to be the |
| 1649 | target of a label's for attribute, so those are included, if any, for |
| 1650 | the sake of consistency and completeness. |
| 1651 | |
| 1652 | """ |
| 1653 | res = [] |
| 1654 | res.extend(self._labels) |
| 1655 | if self.id: |
| 1656 | res.extend(self._control._form._id_to_labels.get(self.id, ())) |
| 1657 | return res |
| 1658 | |
| 1659 | def __getattr__(self, name): |
| 1660 | if name=="selected": |
no test coverage detected