WP_HTML_Tag_Processor::next_token(): bool

In this article

Finds the next token in the HTML document.

Description

An HTML document can be viewed as a stream of tokens, where tokens are things like HTML tags, HTML comments, text nodes, etc. This method finds the next token in the HTML document and returns whether it found one.

If it starts parsing a token and reaches the end of the document then it will seek to the start of the last token and pause, returning false to indicate that it failed to find a complete token.

Possible token types, based on the HTML specification:

  • an HTML tag, whether opening, closing, or void.
  • a text node – the plaintext inside tags.
  • an HTML comment.
  • a DOCTYPE declaration.
  • a processing instruction, e.g. <?xml version="1.0" ?>.

The Tag Processor currently only supports the tag token.

Return

bool Whether a token was parsed.

Source

public function next_token() {
	return $this->base_class_next_token();
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.