endTagCaption method

void endTagCaption(
  1. EndTagToken token
)

Implementation

void endTagCaption(EndTagToken token) {
  if (!ignoreEndTagCaption()) {
    // AT this code is quite similar to endTagTable in "InTable"
    tree.generateImpliedEndTags();
    if (tree.openElements.last.localName != 'caption') {
      parser.parseError(token.span, 'expected-one-end-tag-but-got-another', {
        'gotName': 'caption',
        'expectedName': tree.openElements.last.localName
      });
    }
    while (tree.openElements.last.localName != 'caption') {
      tree.openElements.removeLast();
    }
    final node = tree.openElements.removeLast();
    node.endSourceSpan = token.span;
    tree.clearActiveFormattingElements();
    parser.phase = parser._inTablePhase;
  } else {
    // innerHTML case
    assert(parser.innerHTMLMode);
    parser.parseError(token.span, 'undefined-error');
  }
}