: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
commentStartDash: function () {
var char = this.consume();
this.transitionTo("commentEnd" /* commentEnd */);
this.delegate.finishComment();
this.transitionTo("beforeData" /* beforeData */);
this.delegate.appendToCommentData('-');
this.transitionTo("comment" /* comment */);
var char = this.consume();
this.transitionTo("commentEndDash" /* commentEndDash */);
this.delegate.appendToCommentData(char);
commentEndDash: function () {
var char = this.consume();
this.transitionTo("commentEnd" /* commentEnd */);
this.delegate.appendToCommentData('-' + char);
this.transitionTo("comment" /* comment */);
commentEnd: function () {
var char = this.consume();
this.delegate.finishComment();
this.transitionTo("beforeData" /* beforeData */);
this.delegate.appendToCommentData('--' + char);
this.transitionTo("comment" /* comment */);
var char = this.consume();
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
this.appendToTagName(char);
endTagName: function () {
var char = this.consume();
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
this.appendToTagName(char);
beforeAttributeName: function () {
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
this.delegate.reportSyntaxError('attribute name cannot start with equals sign');
this.transitionTo("attributeName" /* attributeName */);
this.delegate.beginAttribute();
this.delegate.appendToAttributeName(char);
this.transitionTo("attributeName" /* attributeName */);
this.delegate.beginAttribute();
attributeName: function () {
this.transitionTo("afterAttributeName" /* afterAttributeName */);
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
else if (char === '"' || char === "'" || char === '<') {
this.delegate.reportSyntaxError(char + ' is not a valid character within attribute names');
this.delegate.appendToAttributeName(char);
this.delegate.appendToAttributeName(char);
afterAttributeName: function () {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.transitionTo("attributeName" /* attributeName */);
this.delegate.beginAttribute();
this.delegate.appendToAttributeName(char);
beforeAttributeValue: function () {
this.transitionTo("attributeValueDoubleQuoted" /* attributeValueDoubleQuoted */);
this.delegate.beginAttributeValue(true);
this.transitionTo("attributeValueSingleQuoted" /* attributeValueSingleQuoted */);
this.delegate.beginAttributeValue(true);
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
this.transitionTo("attributeValueUnquoted" /* attributeValueUnquoted */);
this.delegate.beginAttributeValue(false);
this.delegate.appendToAttributeValue(char);
attributeValueDoubleQuoted: function () {
var char = this.consume();
this.delegate.finishAttributeValue();
this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
this.delegate.appendToAttributeValue(char);
attributeValueSingleQuoted: function () {
var char = this.consume();
this.delegate.finishAttributeValue();
this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
this.delegate.appendToAttributeValue(char);
attributeValueUnquoted: function () {
this.delegate.finishAttributeValue();
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
this.delegate.finishAttributeValue();
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
this.delegate.finishAttributeValue();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
this.delegate.appendToAttributeValue(char);
afterAttributeValueQuoted: function () {
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
selfClosingStartTag: function () {
this.delegate.markTagAsSelfClosing();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
endTagOpen: function () {
var char = this.consume();
if (char === '@' || char === ':' || isAlpha(char)) {
this.transitionTo("endTagName" /* endTagName */);
this.delegate.beginEndTag();
this.appendToTagName(char);
EventedTokenizer.prototype.reset = function () {
this.transitionTo("beforeData" /* beforeData */);
EventedTokenizer.prototype.transitionTo = function (state) {
EventedTokenizer.prototype.tokenize = function (input) {
this.tokenizePart(input);
EventedTokenizer.prototype.tokenizePart = function (input) {
this.input += preprocessInput(input);
while (this.index < this.input.length) {
var handler = this.states[this.state];
if (handler !== undefined) {
throw new Error("unhandled state " + this.state);
EventedTokenizer.prototype.tokenizeEOF = function () {
EventedTokenizer.prototype.flushData = function () {
if (this.state === 'data') {
this.delegate.finishData();
this.transitionTo("beforeData" /* beforeData */);
EventedTokenizer.prototype.peek = function () {
return this.input.charAt(this.index);
EventedTokenizer.prototype.consume = function () {
EventedTokenizer.prototype.consumeCharRef = function () {
var endIndex = this.input.indexOf(';', this.index);
var entity = this.input.slice(this.index, endIndex);
var chars = this.entityParser.parse(entity);
var count = entity.length;
// consume the entity chars
EventedTokenizer.prototype.markTagStart = function () {
EventedTokenizer.prototype.appendToTagName = function (char) {
this.tagNameBuffer += char;
this.delegate.appendToTagName(char);
EventedTokenizer.prototype.isIgnoredEndTag = function () {
var tag = this.tagNameBuffer;
return (tag === 'title' && this.input.substring(this.index, this.index + 8) !== '</title>') ||
(tag === 'style' && this.input.substring(this.index, this.index + 8) !== '</style>') ||
(tag === 'script' && this.input.substring(this.index, this.index + 9) !== '</script>');
var Tokenizer = /** @class */ (function () {
function Tokenizer(entityParser, options) {
if (options === void 0) { options = {}; }
this.tokenizer = new EventedTokenizer(this, entityParser, options.mode);
this._currentAttribute = undefined;
Tokenizer.prototype.tokenize = function (input) {
this.tokenizer.tokenize(input);
Tokenizer.prototype.tokenizePart = function (input) {
this.tokenizer.tokenizePart(input);
Tokenizer.prototype.tokenizeEOF = function () {
this.tokenizer.tokenizeEOF();
Tokenizer.prototype.reset = function () {
Tokenizer.prototype.current = function () {
throw new Error('token was unexpectedly null');
if (arguments.length === 0) {
for (var i = 0; i < arguments.length; i++) {
if (token.type === arguments[i]) {
throw new Error("token type was unexpectedly " + token.type);
Tokenizer.prototype.push = function (token) {
Tokenizer.prototype.currentAttribute = function () {
return this._currentAttribute;
Tokenizer.prototype.addLocInfo = function () {
line: this.tokenizer.line,
column: this.tokenizer.column
this.startLine = this.tokenizer.line;
this.startColumn = this.tokenizer.column;
Tokenizer.prototype.beginDoctype = function () {
type: "Doctype" /* Doctype */,
Tokenizer.prototype.appendToDoctypeName = function (char) {
this.current("Doctype" /* Doctype */).name += char;
Tokenizer.prototype.appendToDoctypePublicIdentifier = function (char) {
var doctype = this.current("Doctype" /* Doctype */);
if (doctype.publicIdentifier === undefined) {
doctype.publicIdentifier = char;
doctype.publicIdentifier += char;
Tokenizer.prototype.appendToDoctypeSystemIdentifier = function (char) {
var doctype = this.current("Doctype" /* Doctype */);
if (doctype.systemIdentifier === undefined) {
doctype.systemIdentifier = char;
doctype.systemIdentifier += char;
Tokenizer.prototype.endDoctype = function () {
Tokenizer.prototype.beginData = function () {
type: "Chars" /* Chars */,
Tokenizer.prototype.appendToData = function (char) {
this.current("Chars" /* Chars */).chars += char;
Tokenizer.prototype.finishData = function () {
Tokenizer.prototype.beginComment = function () {