WP_HTML_Processor::generate_implied_end_tags( string|null $except_for_this_element = null )

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Closes elements that have implied end tags.

Description

See also

Parameters

$except_for_this_elementstring|nulloptional
Perform as if this element doesn’t exist in the stack of open elements.

Default:null

Source

private function generate_implied_end_tags( ?string $except_for_this_element = null ): void {
	$elements_with_implied_end_tags = array(
		'DD',
		'DT',
		'LI',
		'OPTGROUP',
		'OPTION',
		'P',
		'RB',
		'RP',
		'RT',
		'RTC',
	);

	$no_exclusions = ! isset( $except_for_this_element );

	while (
		( $no_exclusions || ! $this->state->stack_of_open_elements->current_node_is( $except_for_this_element ) ) &&
		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();
	}
}

Changelog

VersionDescription
6.7.0Full spec support.
6.4.0Introduced.

User Contributed Notes

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