Changeset 58840
- Timestamp:
- 08/01/2024 10:34:29 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-processor.php
r58839 r58840 3050 3050 * logic for the generalized WP_HTML_Processor::step() function. 3051 3051 * 3052 * @since 6.7.0 Stub implementation.3052 * @since 6.7.0 3053 3053 * 3054 3054 * @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input. … … 3060 3060 */ 3061 3061 private function step_in_caption(): bool { 3062 $this->bail( 'No support for parsing in the ' . WP_HTML_Processor_State::INSERTION_MODE_IN_CAPTION . ' state.' ); 3062 $tag_name = $this->get_tag(); 3063 $op_sigil = $this->is_tag_closer() ? '-' : '+'; 3064 $op = "{$op_sigil}{$tag_name}"; 3065 3066 switch ( $op ) { 3067 /* 3068 * > An end tag whose tag name is "caption" 3069 * > A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr" 3070 * > An end tag whose tag name is "table" 3071 * 3072 * These tag handling rules are identical except for the final instruction. 3073 * Handle them in a single block. 3074 */ 3075 case '-CAPTION': 3076 case '+CAPTION': 3077 case '+COL': 3078 case '+COLGROUP': 3079 case '+TBODY': 3080 case '+TD': 3081 case '+TFOOT': 3082 case '+TH': 3083 case '+THEAD': 3084 case '+TR': 3085 case '-TABLE': 3086 if ( ! $this->state->stack_of_open_elements->has_element_in_table_scope( 'CAPTION' ) ) { 3087 // Parse error: ignore the token. 3088 return $this->step(); 3089 } 3090 3091 $this->generate_implied_end_tags(); 3092 if ( ! $this->state->stack_of_open_elements->current_node_is( 'CAPTION' ) ) { 3093 // @todo Indicate a parse error once it's possible. 3094 } 3095 3096 $this->state->stack_of_open_elements->pop_until( 'CAPTION' ); 3097 $this->state->active_formatting_elements->clear_up_to_last_marker(); 3098 $this->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_TABLE; 3099 3100 // If this is not a CAPTION end tag, the token should be reprocessed. 3101 if ( '-CAPTION' === $op ) { 3102 return true; 3103 } 3104 return $this->step( self::REPROCESS_CURRENT_NODE ); 3105 3106 /** 3107 * > An end tag whose tag name is one of: "body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr" 3108 */ 3109 case '-BODY': 3110 case '-COL': 3111 case '-COLGROUP': 3112 case '-HTML': 3113 case '-TBODY': 3114 case '-TD': 3115 case '-TFOOT': 3116 case '-TH': 3117 case '-THEAD': 3118 case '-TR': 3119 // Parse error: ignore the token. 3120 return $this->step(); 3121 } 3122 3123 /** 3124 * > Anything else 3125 * > Process the token using the rules for the "in body" insertion mode. 3126 */ 3127 return $this->step_in_body(); 3063 3128 } 3064 3129
Note: See TracChangeset
for help on using the changeset viewer.