@@ -3771,7 +3771,7 @@ private function step_in_select(): bool {
3771
3771
* This internal function performs the 'in select in table' insertion mode
3772
3772
* logic for the generalized WP_HTML_Processor::step() function.
3773
3773
*
3774
- * @since 6.7.0 Stub implementation.
3774
+ * @since 6.7.0
3775
3775
*
3776
3776
* @throws WP_HTML_Unsupported_Exception When encountering unsupported HTML input.
3777
3777
*
@@ -3781,7 +3781,52 @@ private function step_in_select(): bool {
3781
3781
* @return bool Whether an element was found.
3782
3782
*/
3783
3783
private function step_in_select_in_table (): bool {
3784
- $ this ->bail ( 'No support for parsing in the ' . WP_HTML_Processor_State::INSERTION_MODE_IN_SELECT_IN_TABLE . ' state. ' );
3784
+ $ token_name = $ this ->get_token_name ();
3785
+ $ token_type = $ this ->get_token_type ();
3786
+ $ op_sigil = '#tag ' === $ token_type ? ( parent ::is_tag_closer () ? '- ' : '+ ' ) : '' ;
3787
+ $ op = "{$ op_sigil }{$ token_name }" ;
3788
+
3789
+ switch ( $ op ) {
3790
+ /*
3791
+ * > A start tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"
3792
+ */
3793
+ case '+CAPTION ' :
3794
+ case '+TABLE ' :
3795
+ case '+TBODY ' :
3796
+ case '+TFOOT ' :
3797
+ case '+THEAD ' :
3798
+ case '+TR ' :
3799
+ case '+TD ' :
3800
+ case '+TH ' :
3801
+ // @todo Indicate a parse error once it's possible.
3802
+ $ this ->state ->stack_of_open_elements ->pop_until ( 'SELECT ' );
3803
+ $ this ->reset_insertion_mode ();
3804
+ return $ this ->step ( self ::REPROCESS_CURRENT_NODE );
3805
+
3806
+ /*
3807
+ * > An end tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"
3808
+ */
3809
+ case '-CAPTION ' :
3810
+ case '-TABLE ' :
3811
+ case '-TBODY ' :
3812
+ case '-TFOOT ' :
3813
+ case '-THEAD ' :
3814
+ case '-TR ' :
3815
+ case '-TD ' :
3816
+ case '-TH ' :
3817
+ // @todo Indicate a parse error once it's possible.
3818
+ if ( ! $ this ->state ->stack_of_open_elements ->has_element_in_table_scope ( $ token_name ) ) {
3819
+ return $ this ->step ();
3820
+ }
3821
+ $ this ->state ->stack_of_open_elements ->pop_until ( 'SELECT ' );
3822
+ $ this ->reset_insertion_mode ();
3823
+ return $ this ->step ( self ::REPROCESS_CURRENT_NODE );
3824
+ }
3825
+
3826
+ /*
3827
+ * > Anything else
3828
+ */
3829
+ return $ this ->step_in_select ();
3785
3830
}
3786
3831
3787
3832
/**
0 commit comments