WP_HTML_Processor::is_tag_closer(): bool

In this article

Indicates if the current tag token is a tag closer.

Description

Example:

$p = WP_HTML_Processor::create_fragment( '<div></div>' );
$p->next_tag( array( 'tag_name' => 'div', 'tag_closers' => 'visit' ) );
$p->is_tag_closer() === false;

$p->next_tag( array( 'tag_name' => 'div', 'tag_closers' => 'visit' ) );
$p->is_tag_closer() === true;

Return

bool Whether the current tag is a tag closer.

Source

public function is_tag_closer(): bool {
	return $this->is_virtual()
		? ( WP_HTML_Stack_Event::POP === $this->current_element->operation && '#tag' === $this->get_token_type() )
		: parent::is_tag_closer();
}

Changelog

VersionDescription
6.6.0Introduced.

User Contributed Notes

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