Source
def html(self):
if self._name != 'comment':
if self._html != '': return self._html
self._html += '<' + self.name()
for attr in self._attr:
a = self._attr[attr]
if a is not None:
self._html += ' ' + attr + '="' + self._attr[attr] + '"'
try:
if self._attr['checked'] == None:
self._html += ' checked>'
except KeyError:
self._html += '>'
if not is_self_closing(self.name()):
if self.has_child:
size = len(self._children)
j = 0
if 0 in self._textAtNthChild:
self._html += self._text[0]
j += 1
for i in range(size):
self._html += self._children[i].html()
if i + 1 in self._textAtNthChild:
self._html += self._text[j]
j += 1
else:
self._html += self._text[0]
self._html += '' + self.name() + '>'
return self._html
else:
return self.comment()