WP_HTML_Processor::step_in_row
Parses next element in the 'in row' insertion mode.
This internal function performs the 'in row' 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_row(): bool;
Заметки
- Смотрите: https://html.spec.whatwg.org/#parsing-main-intr
- Смотрите: WP_HTML_Processor::step
Список изменений
| С версии 6.7.0 | Введена. |
Код WP_HTML_Processor::step_in_row() WP HTML Processor::step in row WP 6.8.3
private function step_in_row(): bool {
$tag_name = $this->get_tag();
$op_sigil = $this->is_tag_closer() ? '-' : '+';
$op = "{$op_sigil}{$tag_name}";
switch ( $op ) {
/*
* > A start tag whose tag name is one of: "th", "td"
*/
case '+TH':
case '+TD':
$this->state->stack_of_open_elements->clear_to_table_row_context();
$this->insert_html_element( $this->state->current_token );
$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_CELL;
$this->state->active_formatting_elements->insert_marker();
return true;
/*
* > An end tag whose tag name is "tr"
*/
case '-TR':
if ( ! $this->state->stack_of_open_elements->has_element_in_table_scope( 'TR' ) ) {
// Parse error: ignore the token.
return $this->step();
}
$this->state->stack_of_open_elements->clear_to_table_row_context();
$this->state->stack_of_open_elements->pop();
$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_TABLE_BODY;
return true;
/*
* > A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr"
* > An end tag whose tag name is "table"
*/
case '+CAPTION':
case '+COL':
case '+COLGROUP':
case '+TBODY':
case '+TFOOT':
case '+THEAD':
case '+TR':
case '-TABLE':
if ( ! $this->state->stack_of_open_elements->has_element_in_table_scope( 'TR' ) ) {
// Parse error: ignore the token.
return $this->step();
}
$this->state->stack_of_open_elements->clear_to_table_row_context();
$this->state->stack_of_open_elements->pop();
$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_TABLE_BODY;
return $this->step( self::REPROCESS_CURRENT_NODE );
/*
* > An end tag whose tag name is one of: "tbody", "tfoot", "thead"
*/
case '-TBODY':
case '-TFOOT':
case '-THEAD':
if ( ! $this->state->stack_of_open_elements->has_element_in_table_scope( $tag_name ) ) {
// Parse error: ignore the token.
return $this->step();
}
if ( ! $this->state->stack_of_open_elements->has_element_in_table_scope( 'TR' ) ) {
// Ignore the token.
return $this->step();
}
$this->state->stack_of_open_elements->clear_to_table_row_context();
$this->state->stack_of_open_elements->pop();
$this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_TABLE_BODY;
return $this->step( self::REPROCESS_CURRENT_NODE );
/*
* > An end tag whose tag name is one of: "body", "caption", "col", "colgroup", "html", "td", "th"
*/
case '-BODY':
case '-CAPTION':
case '-COL':
case '-COLGROUP':
case '-HTML':
case '-TD':
case '-TH':
// Parse error: ignore the token.
return $this->step();
}
/*
* > Anything else
* > Process the token using the rules for the "in table" insertion mode.
*/
return $this->step_in_table();
}