endTagBody method

void endTagBody(
  1. EndTagToken token
)

Implementation

void endTagBody(EndTagToken token) {
  if (!tree.elementInScope('body')) {
    parser.parseError(token.span, 'undefined-error');
    return;
  } else if (tree.openElements.last.localName == 'body') {
    tree.openElements.last.endSourceSpan = token.span;
  } else {
    for (var node in slice(tree.openElements, 2)) {
      switch (node.localName) {
        case 'dd':
        case 'dt':
        case 'li':
        case 'optgroup':
        case 'option':
        case 'p':
        case 'rp':
        case 'rt':
        case 'tbody':
        case 'td':
        case 'tfoot':
        case 'th':
        case 'thead':
        case 'tr':
        case 'body':
        case 'html':
          continue;
      }
      // Not sure this is the correct name for the parse error
      parser.parseError(token.span, 'expected-one-end-tag-but-got-another',
          {'gotName': 'body', 'expectedName': node.localName});
      break;
    }
  }
  parser.phase = parser._afterBodyPhase;
}