WP_HTML_Processor::is_html_integration_point()
Indicates if the current token is an HTML integration point.
Note that this method must be an instance method with access to the current token, since it needs to examine the attributes of the currently-matched tag, if it's in the MathML namespace. Otherwise it would be required to scan the HTML and ensure that no other accounting is overlooked.
Method of the class: WP_HTML_Processor{}
No Hooks.
Return
true|false
. Whether the current token is an HTML integration point.
Usage
// private - for code of main (parent) class only $result = $this->is_html_integration_point(): bool;
Notes
Changelog
Since 6.7.0 | Introduced. |
WP_HTML_Processor::is_html_integration_point() WP HTML Processor::is html integration point code WP 6.7.1
private function is_html_integration_point(): bool { $current_token = $this->state->current_token; if ( ! isset( $current_token ) ) { return false; } if ( 'html' === $current_token->namespace ) { return false; } $tag_name = $current_token->node_name; if ( 'svg' === $current_token->namespace ) { return ( 'DESC' === $tag_name || 'FOREIGNOBJECT' === $tag_name || 'TITLE' === $tag_name ); } if ( 'math' === $current_token->namespace ) { if ( 'ANNOTATION-XML' !== $tag_name ) { return false; } $encoding = $this->get_attribute( 'encoding' ); return ( is_string( $encoding ) && ( 0 === strcasecmp( $encoding, 'application/xhtml+xml' ) || 0 === strcasecmp( $encoding, 'text/html' ) ) ); } $this->bail( 'Should not have reached end of HTML Integration Point detection: check HTML API code.' ); // This unnecessary return prevents tools from inaccurately reporting type errors. return false; }