src/lib/Parser.js
/**
  Consumes a doctype declaration if possible.

  This is a loose implementation since doctype declarations are currently
  discarded without further parsing.

  @returns {boolean}
    Whether a doctype declaration was consumed.

  @see https://www.w3.org/TR/2008/REC-xml-20081126/#dtd
  */
Consumes a doctype declaration if possible.
This is a loose implementation since doctype declarations are currently
discarded without further parsing.
Consumes a doctype declaration if possible . This is a loose implementation since doctype declarations are currently discarded without further parsing .
consumeDoctypeDeclaration() {
    let { scanner } = this;
    if (!scanner.consumeStringFast('<!DOCTYPE')
        || !this.consumeWhitespace()) {
      return false;
    }
    scanner.consumeMatch(/[^[>]+/y);
    if (scanner.consumeMatch(/\[[\s\S]+?\][\x20\t\r\n]*>/y)) {
      return true;
    }
    if (!scanner.consumeStringFast('>')) {
      this.error('Unclosed doctype declaration');
    }
    return true;
  }
consumeDoctypeDeclaration ( ) { let { scanner } = this ; if ( ! scanner . consumeStringFast ( '<!DOCTYPE' ) || ! this . consumeWhitespace ( ) ) { return false ; } scanner . consumeMatch ( / [^[>]+ / y ) ; if ( scanner . consumeMatch ( / \[[\s\S]+?\][\x20\t\r\n]*> / y ) ) { return true ; } if ( ! scanner . consumeStringFast ( '>' ) ) { this . error ( 'Unclosed doctype declaration' ) ; } return true ; }
Consumes a doctype declaration if possible.
Consumes a doctype declaration if possible .