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
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
| Version | Description |
|---|---|
| 6.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.