validator/engine/htmlparser.js
/**
   * Upon exiting a tag, validation for the current matcher is triggered,
   * e.g. for checking that the tag had some specified number of children.
   * @param {!string} tagName
   */
Upon exiting a tag, validation for the current matcher is triggered,
e.g. for checking that the tag had some specified number of children.
@param {!string} tagName
Upon exiting a tag validation for the current matcher is triggered e . g . for checking that the tag had some specified number of children . @param { !string } tagName
endTag(tagName) {
    if (this.region_ == TagRegion.IN_HEAD && tagName === 'HEAD')
      this.region_ = TagRegion.PRE_BODY;
    if (tagName === 'BODY') return;
    for (let idx = this.stack_.length - 1; idx >= 0; idx--) {
      if (this.stack_[idx] === tagName) {
        while (this.stack_.length > idx) {
          if (this.handler_.endTag) {
            this.handler_.endTag(this.stack_.pop());
          }
        }
        return;
      }
    }
  }
endTag ( tagName ) { if ( this . region_ == TagRegion . IN_HEAD && tagName === 'HEAD' ) this . region_ = TagRegion . PRE_BODY ; if ( tagName === 'BODY' ) return ; for ( let idx = this . stack_ . length - 1 ; idx >= 0 ; idx -- ) { if ( this . stack_ [ idx ] === tagName ) { while ( this . stack_ . length > idx ) { if ( this . handler_ . endTag ) { this . handler_ . endTag ( this . stack_ . pop ( ) ) ; } } return ; } } }
Upon exiting a tag, validation for the current matcher is triggered,
 e.g.
Upon exiting a tag validation for the current matcher is triggered e . g .
// We ignore close body tags (</body) and instead insert them when their // outer scope is closed (/html). This is closer to how a browser parser // works. The idea here is if other tags are found after the <body>, // (ex: <div>) which are only allowed in the <body>, we will effectively // move them into the body section. // We look for tagName from the end. If we can find it, we pop // everything from thereon off the stack. If we can't find it, // we don't bother with closing the tag, since it doesn't have // a matching open tag, though in practice the HtmlParser class // will have already manufactured a start tag.