WP_HTML_Processor::reconstruct_active_formatting_elements
Reconstructs the active formatting elements.
This has the effect of reopening all the formatting elements that were opened > in the current body, cell, or caption (whichever is youngest) that haven't > been explicitly closed.
Method of the class: WP_HTML_Processor{}
No Hooks.
Returns
true|false. Whether any formatting elements needed to be reconstructed.
Usage
// private - for code of main (parent) class only $result = $this->reconstruct_active_formatting_elements(): bool;
Notes
Changelog
| Since 6.4.0 | Introduced. |
WP_HTML_Processor::reconstruct_active_formatting_elements() WP HTML Processor::reconstruct active formatting elements code WP 7.0
private function reconstruct_active_formatting_elements(): bool {
/*
* > If there are no entries in the list of active formatting elements, then there is nothing
* > to reconstruct; stop this algorithm.
*/
if ( 0 === $this->state->active_formatting_elements->count() ) {
return false;
}
$last_entry = $this->state->active_formatting_elements->current_node();
if (
/*
* > If the last (most recently added) entry in the list of active formatting elements is a marker;
* > stop this algorithm.
*/
'marker' === $last_entry->node_name ||
/*
* > If the last (most recently added) entry in the list of active formatting elements is an
* > element that is in the stack of open elements, then there is nothing to reconstruct;
* > stop this algorithm.
*/
$this->state->stack_of_open_elements->contains_node( $last_entry )
) {
return false;
}
$this->bail( 'Cannot reconstruct active formatting elements when advancing and rewinding is required.' );
}