isVoidElement function

bool isVoidElement(
  1. String? tagName
)

Returns true if this tag name is a void element. This method is useful to a pretty printer, because void elements must not have an end tag. See also: dev.w3.org/html5/markup/syntax.html#void-elements.

Implementation

bool isVoidElement(String? tagName) {
  switch (tagName) {
    case 'area':
    case 'base':
    case 'br':
    case 'col':
    case 'command':
    case 'embed':
    case 'hr':
    case 'img':
    case 'input':
    case 'keygen':
    case 'link':
    case 'meta':
    case 'param':
    case 'source':
    case 'track':
    case 'wbr':
      return true;
  }
  return false;
}