WP_HTML_Processor::step_in_caption(): 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 caption’ insertion mode.

Description

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

See also

Return

bool Whether an element was found.

Source

		 *
		 * @see https://html.spec.whatwg.org/#parsing-main-intabletext
		 */
		if ( parent::TEXT_IS_WHITESPACE === $this->text_node_classification ) {
			$this->insert_html_element( $this->state->current_token );
			return true;
		}

		// Non-whitespace would trigger fostering, unsupported at this time.
		$this->bail( 'Foster parenting is not supported.' );
		break;
	}
	break;

/*
 * > A comment token
 * > A processing instruction token
 */
case '#comment':
case '#funky-comment':
case '#presumptuous-tag':
case '#processing-instruction':
	$this->insert_html_element( $this->state->current_token );
	return true;

/*
 * > A DOCTYPE token
 */
case 'html':
	// Parse error: ignore the token.
	return $this->step();

/*
 * > A start tag whose tag name is "caption"
 */
case '+CAPTION':
	$this->state->stack_of_open_elements->clear_to_table_context();
	$this->state->active_formatting_elements->insert_marker();
	$this->insert_html_element( $this->state->current_token );
	$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_CAPTION;
	return true;

/*
 * > A start tag whose tag name is "colgroup"
 */
case '+COLGROUP':
	$this->state->stack_of_open_elements->clear_to_table_context();
	$this->insert_html_element( $this->state->current_token );
	$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_COLUMN_GROUP;
	return true;

/*
 * > A start tag whose tag name is "col"
 */
case '+COL':
	$this->state->stack_of_open_elements->clear_to_table_context();

	/*
	 * > Insert an HTML element for a "colgroup" start tag token with no attributes,
	 * > then switch the insertion mode to "in column group".
	 */
	$this->insert_virtual_node( 'COLGROUP' );
	$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_COLUMN_GROUP;
	return $this->step( self::REPROCESS_CURRENT_NODE );

/*
 * > A start tag whose tag name is one of: "tbody", "tfoot", "thead"
 */

Changelog

VersionDescription
6.7.0Introduced.

User Contributed Notes

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