WP_HTML_Processor::generate_implied_end_tags()privateWP 6.4.0

Closes elements that have implied end tags.

Method of the class: WP_HTML_Processor{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->generate_implied_end_tags( $except_for_this_element );
$except_for_this_element(string|null)
Perform as if this element doesn't exist in the stack of open elements.
Default: null

Notes

Changelog

Since 6.4.0 Introduced.

WP_HTML_Processor::generate_implied_end_tags() code WP 6.6.2

private function generate_implied_end_tags( $except_for_this_element = null ) {
	$elements_with_implied_end_tags = array(
		'DD',
		'DT',
		'LI',
		'P',
	);

	$current_node = $this->state->stack_of_open_elements->current_node();
	while (
		$current_node && $current_node->node_name !== $except_for_this_element &&
		in_array( $this->state->stack_of_open_elements->current_node(), $elements_with_implied_end_tags, true )
	) {
		$this->state->stack_of_open_elements->pop();
	}
}