WP_HTML_Processor::generate_implied_end_tags_thoroughlyprivateWP 6.4.0

Closes elements that have implied end tags, thoroughly.

See the HTML specification for an explanation why this is different from generating end tags in the normal sense.

Method of the class: WP_HTML_Processor{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->generate_implied_end_tags_thoroughly(): void;

Notes

Changelog

Since 6.4.0 Introduced.
Since 6.7.0 Full spec support.

WP_HTML_Processor::generate_implied_end_tags_thoroughly() code WP 6.8.3

private function generate_implied_end_tags_thoroughly(): void {
	$elements_with_implied_end_tags = array(
		'CAPTION',
		'COLGROUP',
		'DD',
		'DT',
		'LI',
		'OPTGROUP',
		'OPTION',
		'P',
		'RB',
		'RP',
		'RT',
		'RTC',
		'TBODY',
		'TD',
		'TFOOT',
		'TH',
		'THEAD',
		'TR',
	);

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