WP_HTML_Tag_Processor::get_doctype_info()
Gets DOCTYPE declaration info from a DOCTYPE token.
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.
Method of the class: WP_HTML_Tag_Processor{}
No Hooks.
Return
WP_HTML_Doctype_Info|null
. The DOCTYPE declaration information or null if not currently at a DOCTYPE node.
Usage
$WP_HTML_Tag_Processor = new WP_HTML_Tag_Processor(); $WP_HTML_Tag_Processor->get_doctype_info(): ?WP_HTML_Doctype_Info;
WP_HTML_Tag_Processor::get_doctype_info() WP HTML Tag Processor::get doctype info code WP 6.7.1
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 ) ); }