WP_HTML_Tag_Processor::change_parsing_namespace
Switches parsing mode into a new namespace, such as when encountering an SVG tag and entering foreign content.
Method of the class: WP_HTML_Tag_Processor{}
No Hooks.
Returns
true|false. Whether the namespace was valid and changed.
Usage
$WP_HTML_Tag_Processor = new WP_HTML_Tag_Processor(); $WP_HTML_Tag_Processor->change_parsing_namespace( $new_namespace ): bool;
- $new_namespace(string) (required)
- One of 'html', 'svg', or 'math' indicating into what namespace the next tokens will be processed.
Changelog
| Since 6.7.0 | Introduced. |
WP_HTML_Tag_Processor::change_parsing_namespace() WP HTML Tag Processor::change parsing namespace code WP 6.9
public function change_parsing_namespace( string $new_namespace ): bool {
if ( ! in_array( $new_namespace, array( 'html', 'math', 'svg' ), true ) ) {
return false;
}
$this->parsing_namespace = $new_namespace;
return true;
}