@@ -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 'AREA ' :
10061069 case 'BASE ' :
10071070 case 'BASEFONT ' :
@@ -1010,26 +1073,18 @@ private function step_in_body() {
10101073 case 'CAPTION ' :
10111074 case 'COL ' :
10121075 case 'COLGROUP ' :
1013- case 'DD ' :
1014- case 'DT ' :
10151076 case 'FORM ' :
10161077 case 'FRAME ' :
10171078 case 'FRAMESET ' :
10181079 case 'HEAD ' :
10191080 case 'HTML ' :
1020- case 'IFRAME ' :
10211081 case 'INPUT ' :
1022- case 'LI ' :
10231082 case 'LINK ' :
1024- case 'MARQUEE ' :
10251083 case 'MATH ' :
10261084 case 'META ' :
10271085 case 'NOBR ' :
1028- case 'NOEMBED ' :
10291086 case 'NOFRAMES ' :
10301087 case 'NOSCRIPT ' :
1031- case 'OBJECT ' :
1032- case 'OL ' :
10331088 case 'OPTGROUP ' :
10341089 case 'OPTION ' :
10351090 case 'PARAM ' :
@@ -1048,15 +1103,13 @@ private function step_in_body() {
10481103 case 'TBODY ' :
10491104 case 'TD ' :
10501105 case 'TEMPLATE ' :
1051- case 'TEXTAREA ' :
10521106 case 'TFOOT ' :
10531107 case 'TH ' :
10541108 case 'THEAD ' :
10551109 case 'TITLE ' :
10561110 case 'TR ' :
10571111 case 'TRACK ' :
10581112 case 'UL ' :
1059- case 'XMP ' :
10601113 $ this ->last_error = self ::ERROR_UNSUPPORTED ;
10611114 throw new WP_HTML_Unsupported_Exception ( "Cannot process {$ tag_name } element. " );
10621115 }
0 commit comments