isValidNode method

bool isValidNode(
  1. TagflowNode node
)

Implementation

bool isValidNode(TagflowNode node) {
  const excludeTags = ['table'];
  if (node.isEmpty) return false;
  if (node.isTextNode && !excludeTags.contains(node.tag)) {
    return node.textContent?.trim().isNotEmpty ?? false;
  }

  // except for table cells, empty nodes are valid
  if (excludeTags.contains(node.tag)) {
    return true;
  }

  return node.hasChildren || node.children.every(isValidNode);
}