toTextNode static method

DOMNode toTextNode(
  1. String? text
)

Implementation

static DOMNode toTextNode(String? text) {
  if (text == null || text.isEmpty) {
    return TextNode('');
  }

  if (DOMTemplate.possiblyATemplate(text)) {
    var template = DOMTemplate.tryParse(text);
    return template != null ? TemplateNode(template) : TextNode(text, true);
  } else {
    return TextNode(text, false);
  }
}