Arguments
- Name: tag, Type: str
- tag name
Source
def handle_endtag(self, tag):
if self._is_started:
if tag == 'body':
self._is_started = False
self._dom.pop()
assert len(self._dom) == 0, 'dom stack is not empty'
else:
end_node = self._dom.pop()
end_node.parent()._children.extend(end_node.children())
assert len(self._dom) != 0, 'dom stack is empty but parsing has not ended'