Returns the last error, if any.
Description
Various situations lead to parsing failure but this class will return false
in all those cases. To determine why something failed it’s possible to request the last error. This can be helpful to know to distinguish whether a given tag couldn’t be found or if content in the document caused the processor to give up and abort processing.
Example
$processor = WP_HTML_Processor::create_fragment( '<template><strong><button><em><p><em>' );
false === $processor->next_tag();
WP_HTML_Processor::ERROR_UNSUPPORTED === $processor->get_last_error();
See also
Source
function ( WP_HTML_Token $token ): void {
$is_virtual = ! isset( $this->state->current_token ) || ! $this->is_tag_closer();
$same_node = isset( $this->state->current_token ) && $token->node_name === $this->state->current_token->node_name;
Changelog
Version | Description |
---|---|
6.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.