@@ -516,7 +516,26 @@ public function step( $node_to_process = self::PROCESS_NEXT_NODE ) {
516516 * is provided in the opening tag, otherwise it expects a tag closer.
517517 */
518518 $ top_node = $ this ->state ->stack_of_open_elements ->current_node ();
519- if ( $ top_node && self ::is_void ( $ top_node ->node_name ) ) {
519+ if (
520+ $ top_node &&
521+ (
522+ self ::is_void ( $ top_node ->node_name ) ||
523+
524+ // Special: Skips SCRIPT data in Tag Processor.
525+ 'SCRIPT ' === $ top_node ->node_name ||
526+
527+ // Special: Skips RCDATA data in Tag Processor.
528+ 'TEXTAREA ' === $ top_node ->node_name ||
529+ 'TITLE ' === $ top_node ->node_name ||
530+
531+ // Special: Skips RAWTEXT data in Tag Processor.
532+ 'IFRAME ' === $ top_node ->node_name ||
533+ 'NOEMBED ' === $ top_node ->node_name ||
534+ 'NOFRAMES ' === $ top_node ->node_name ||
535+ 'STYLE ' === $ top_node ->node_name ||
536+ 'XMP ' === $ top_node ->node_name
537+ )
538+ ) {
520539 $ this ->state ->stack_of_open_elements ->pop ();
521540 }
522541
@@ -948,6 +967,18 @@ private function step_in_body() {
948967 $ this ->run_adoption_agency_algorithm ();
949968 return true ;
950969
970+ /*
971+ * > A start tag whose tag name is one of: "applet", "marquee", "object"
972+ */
973+ case '+APPLET ' :
974+ case '+MARQUEE ' :
975+ case '+OBJECT ' :
976+ $ this ->reconstruct_active_formatting_elements ();
977+ $ this ->insert_html_element ( $ this ->state ->current_token );
978+ $ this ->state ->active_formatting_elements ->insert_marker ();
979+ $ this ->state ->frameset_ok = false ;
980+ return true ;
981+
951982 /*
952983 * > An end tag whose tag name is "br"
953984 * > Parse error. Drop the attributes from the token, and act as described in the next
@@ -982,6 +1013,39 @@ private function step_in_body() {
9821013 $ this ->insert_html_element ( $ this ->state ->current_token );
9831014 $ this ->state ->frameset_ok = false ;
9841015 return true ;
1016+
1017+ /*
1018+ * > A start tag whose tag name is "textarea"
1019+ */
1020+ case '+TEXTAREA ' :
1021+ $ this ->insert_html_element ( $ this ->state ->current_token );
1022+ $ this ->state ->frameset_ok = false ;
1023+ return true ;
1024+
1025+ /*
1026+ * > A start tag whose tag name is "xmp"
1027+ */
1028+ case '+XMP ' :
1029+ if ( $ this ->state ->stack_of_open_elements ->has_p_in_button_scope () ) {
1030+ $ this ->close_a_p_element ();
1031+ }
1032+ $ this ->reconstruct_active_formatting_elements ();
1033+ $ this ->insert_html_element ( $ this ->state ->current_token );
1034+ $ this ->state ->frameset_ok = false ;
1035+ return true ;
1036+
1037+ /*
1038+ * > A start tag whose tag name is "iframe"
1039+ */
1040+ case '+IFRAME ' :
1041+ $ this ->state ->frameset_ok = false ;
1042+ return true ;
1043+
1044+ /*
1045+ * > A start tag whose tag name is "noembed"
1046+ */
1047+ case '+NOEMBED ' :
1048+ return true ;
9851049 }
9861050
9871051 /*
@@ -1001,7 +1065,6 @@ private function step_in_body() {
10011065 * @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
10021066 */
10031067 switch ( $ tag_name ) {
1004- case 'APPLET ' :
10051068 case 'BASE ' :
10061069 case 'BASEFONT ' :
10071070 case 'BGSOUND ' :
@@ -1014,17 +1077,13 @@ private function step_in_body() {
10141077 case 'FRAMESET ' :
10151078 case 'HEAD ' :
10161079 case 'HTML ' :
1017- case 'IFRAME ' :
10181080 case 'INPUT ' :
10191081 case 'LINK ' :
1020- case 'MARQUEE ' :
10211082 case 'MATH ' :
10221083 case 'META ' :
10231084 case 'NOBR ' :
1024- case 'NOEMBED ' :
10251085 case 'NOFRAMES ' :
10261086 case 'NOSCRIPT ' :
1027- case 'OBJECT ' :
10281087 case 'OPTGROUP ' :
10291088 case 'OPTION ' :
10301089 case 'PARAM ' :
@@ -1043,14 +1102,12 @@ private function step_in_body() {
10431102 case 'TBODY ' :
10441103 case 'TD ' :
10451104 case 'TEMPLATE ' :
1046- case 'TEXTAREA ' :
10471105 case 'TFOOT ' :
10481106 case 'TH ' :
10491107 case 'THEAD ' :
10501108 case 'TITLE ' :
10511109 case 'TR ' :
10521110 case 'TRACK ' :
1053- case 'XMP ' :
10541111 $ this ->last_error = self ::ERROR_UNSUPPORTED ;
10551112 throw new WP_HTML_Unsupported_Exception ( "Cannot process {$ tag_name } element. " );
10561113 }
0 commit comments