WP_HTML_Processor::reconstruct_active_formatting_elements()privateWP 6.4.0

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.

Метод класса: WP_HTML_Processor{}

Хуков нет.

Возвращает

true|false. Whether any formatting elements needed to be reconstructed.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->reconstruct_active_formatting_elements();

Заметки

Список изменений

С версии 6.4.0 Введена.

Код WP_HTML_Processor::reconstruct_active_formatting_elements() 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.' );
}