WP_HTML_Tag_Processor::get_doctype_info(): WP_HTML_Doctype_Info|null

In this article

Gets DOCTYPE declaration info from a DOCTYPE token.

Description

DOCTYPE tokens may appear in many places in an HTML document. In most places, they are simply ignored. The main parsing functions find the basic shape of DOCTYPE tokens but do not perform detailed parsing.

This method can be called to perform a full parse of the DOCTYPE token and retrieve its information.

Return

WP_HTML_Doctype_Info|null The DOCTYPE declaration information or null if not currently at a DOCTYPE node.

Source

public function get_doctype_info(): ?WP_HTML_Doctype_Info {
	if ( self::STATE_DOCTYPE !== $this->parser_state ) {
		return null;
	}

	return WP_HTML_Doctype_Info::from_doctype_token( substr( $this->html, $this->token_starts_at, $this->token_length ) );
}

User Contributed Notes

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