WP_HTML_Processor::generate_implied_end_tags
Closes elements that have implied end tags.
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( ?string $except_for_this_element ): void;
- ?string $except_for_this_element
- .
Default:null
Notes
Changelog
| Since 6.4.0 | Introduced. |
| Since 6.7.0 | Full spec support. |
WP_HTML_Processor::generate_implied_end_tags() WP HTML Processor::generate implied end tags code WP 7.0.4
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();
}
}