WP_HTML_Open_Elements::after_element_pop()publicWP 6.4.0

Updates internal flags after removing an element.

Certain conditions (such as "has_p_in_button_scope") are maintained here as flags that are only modified when adding and removing elements. This allows the HTML Processor to quickly check for these conditions instead of iterating over the open stack elements upon each new tag it encounters. These flags, however, need to be maintained as items are added and removed from the stack.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$WP_HTML_Open_Elements = new WP_HTML_Open_Elements();
$WP_HTML_Open_Elements->after_element_pop( $item );
$item(WP_HTML_Token) (обязательный)
Element that was removed from the stack of open elements.

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

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

Код WP_HTML_Open_Elements::after_element_pop() WP 6.6.2

public function after_element_pop( $item ) {
	/*
	 * When adding support for new elements, expand this switch to trap
	 * cases where the precalculated value needs to change.
	 */
	switch ( $item->node_name ) {
		case 'BUTTON':
			$this->has_p_in_button_scope = $this->has_element_in_button_scope( 'P' );
			break;

		case 'P':
			$this->has_p_in_button_scope = $this->has_element_in_button_scope( 'P' );
			break;
	}

	if ( null !== $this->pop_handler ) {
		( $this->pop_handler )( $item );
	}
}