WP_Interactivity_API_Directives_Processor::skip_to_tag_closer()publicWP 6.5.0

Skips processing the content between tags.

It positions the cursor in the closer tag of the foreign element, if it exists.

This function is intended to skip processing SVG and MathML inner content instead of bailing out the whole processing.

Method of the class: WP_Interactivity_API_Directives_Processor{}

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

true|false. Whether the foreign content was successfully skipped.

Usage

$WP_Interactivity_API_Directives_Processor = new WP_Interactivity_API_Directives_Processor();
$WP_Interactivity_API_Directives_Processor->skip_to_tag_closer(): bool;

Changelog

Since 6.5.0 Introduced.

WP_Interactivity_API_Directives_Processor::skip_to_tag_closer() code WP 6.5.4

public function skip_to_tag_closer(): bool {
	$depth    = 1;
	$tag_name = $this->get_tag();
	while ( $depth > 0 && $this->next_tag(
		array(
			'tag_name'    => $tag_name,
			'tag_closers' => 'visit',
		)
	) ) {
		if ( $this->has_self_closing_flag() ) {
			continue;
		}
		$depth += $this->is_tag_closer() ? -1 : 1;
	}

	return 0 === $depth;
}