WP_HTML_Processor::step_in_table_body(): bool

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Parses next element in the ‘in table body’ insertion mode.

Description

This internal function performs the ‘in table body’ insertion mode logic for the generalized WP_HTML_Processor::step() function.

See also

Return

bool Whether an element was found.

Source

	anything_else:
	$this->bail( 'Foster parenting is not supported.' );
}

/**
 * Parses next element in the 'in table text' insertion mode.
 *
 * This internal function performs the 'in table text' insertion mode
 * logic for the generalized WP_HTML_Processor::step() function.
 *
 * @since 6.7.0 Stub implementation.
 * @ignore
 *
 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
 *
 * @see https://html.spec.whatwg.org/#parsing-main-intabletext
 * @see WP_HTML_Processor::step
 *
 * @return bool Whether an element was found.
 */
private function step_in_table_text(): bool {
	$this->bail( 'No support for parsing in the ' . WP_HTML_Processor_State::INSERTION_MODE_IN_TABLE_TEXT . ' state.' );
}

/**
 * Parses next element in the 'in caption' insertion mode.
 *
 * This internal function performs the 'in caption' insertion mode
 * logic for the generalized WP_HTML_Processor::step() function.
 *
 * @since 6.7.0
 * @ignore
 *
 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
 *
 * @see https://html.spec.whatwg.org/#parsing-main-incaption
 * @see WP_HTML_Processor::step
 *
 * @return bool Whether an element was found.
 */
private function step_in_caption(): bool {
	$tag_name = $this->get_tag();
	$op_sigil = $this->is_tag_closer() ? '-' : '+';
	$op       = "{$op_sigil}{$tag_name}";

	switch ( $op ) {
		/*
		 * > An end tag whose tag name is "caption"
		 * > A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"
		 * > An end tag whose tag name is "table"
		 *
		 * These tag handling rules are identical except for the final instruction.
		 * Handle them in a single block.
		 */
		case '-CAPTION':
		case '+CAPTION':
		case '+COL':
		case '+COLGROUP':
		case '+TBODY':
		case '+TD':
		case '+TFOOT':
		case '+TH':
		case '+THEAD':
		case '+TR':
		case '-TABLE':
			if ( ! $this->state->stack_of_open_elements->has_element_in_table_scope( 'CAPTION' ) ) {
				// Parse error: ignore the token.
				return $this->step();
			}

			$this->generate_implied_end_tags();
			if ( ! $this->state->stack_of_open_elements->current_node_is( 'CAPTION' ) ) {
				// @todo Indicate a parse error once it's possible.
			}

			$this->state->stack_of_open_elements->pop_until( 'CAPTION' );
			$this->state->active_formatting_elements->clear_up_to_last_marker();
			$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_TABLE;

			// If this is not a CAPTION end tag, the token should be reprocessed.
			if ( '-CAPTION' === $op ) {
				return true;
			}
			return $this->step( self::REPROCESS_CURRENT_NODE );

		/**
		 * > An end tag whose tag name is one of: "body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr"

Changelog

VersionDescription
6.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.