WP_HTML_Processor::step_in_select_in_table()privateWP 6.7.0

Parses next element in the 'in select in table' insertion mode.

This internal function performs the 'in select in table' insertion mode logic for the generalized WP_HTML_Processor::step() function.

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

Хуков нет.

Возвращает

true|false. Whether an element was found.

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

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

Заметки

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

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

Код WP_HTML_Processor::step_in_select_in_table() WP 6.8.1

private function step_in_select_in_table(): bool {
	$token_name = $this->get_token_name();
	$token_type = $this->get_token_type();
	$op_sigil   = '#tag' === $token_type ? ( parent::is_tag_closer() ? '-' : '+' ) : '';
	$op         = "{$op_sigil}{$token_name}";

	switch ( $op ) {
		/*
		 * > A start tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"
		 */
		case '+CAPTION':
		case '+TABLE':
		case '+TBODY':
		case '+TFOOT':
		case '+THEAD':
		case '+TR':
		case '+TD':
		case '+TH':
			// @todo Indicate a parse error once it's possible.
			$this->state->stack_of_open_elements->pop_until( 'SELECT' );
			$this->reset_insertion_mode_appropriately();
			return $this->step( self::REPROCESS_CURRENT_NODE );

		/*
		 * > An end tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"
		 */
		case '-CAPTION':
		case '-TABLE':
		case '-TBODY':
		case '-TFOOT':
		case '-THEAD':
		case '-TR':
		case '-TD':
		case '-TH':
			// @todo Indicate a parse error once it's possible.
			if ( ! $this->state->stack_of_open_elements->has_element_in_table_scope( $token_name ) ) {
				return $this->step();
			}
			$this->state->stack_of_open_elements->pop_until( 'SELECT' );
			$this->reset_insertion_mode_appropriately();
			return $this->step( self::REPROCESS_CURRENT_NODE );
	}

	/*
	 * > Anything else
	 */
	return $this->step_in_select();
}