visitElement method

  1. @override
void visitElement(
  1. Element node
)
override

Implementation

@override
void visitElement(Element node) {
  final tag = node.localName;
  _str.write('&lt;<code class="markup element-name">$tag</code>');
  if (node.attributes.isNotEmpty) {
    node.attributes.forEach((key, v) {
      v = htmlSerializeEscape(v, attributeMode: true);
      _str.write(' <code class="markup attribute-name">$key</code>'
          '=<code class="markup attribute-value">"$v"</code>');
    });
  }
  if (node.nodes.isNotEmpty) {
    _str.write('>');
    visitChildren(node);
  } else if (isVoidElement(tag)) {
    _str.write('>');
    return;
  }
  _str.write('&lt;/<code class="markup element-name">$tag</code>>');
}