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.
Return
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();
Notes
Changelog
Since 6.4.0 | Introduced. |
WP_HTML_Processor::reconstruct_active_formatting_elements() WP HTML Processor::reconstruct active formatting elements code WP 6.6.2
private function reconstruct_active_formatting_elements() { /* * > 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->last_error = self::ERROR_UNSUPPORTED; throw new WP_HTML_Unsupported_Exception( 'Cannot reconstruct active formatting elements when advancing and rewinding is required.' ); }