Skip to content

Commit 4639ff8

Browse files
committed
Remove early bailout of special elements. It's duplicated.
1 parent 8793d47 commit 4639ff8

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

src/wp-includes/html-api/class-wp-html-tag-processor.php

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -908,23 +908,6 @@ public function next_token() {
908908
}
909909

910910
$tag_name = $this->get_tag();
911-
if (
912-
// Skips SCRIPT data.
913-
'SCRIPT' !== $tag_name &&
914-
915-
// Skips RCDATA data.
916-
'TEXTAREA' !== $tag_name &&
917-
'TITLE' !== $tag_name &&
918-
919-
// Skips RAWTEXT data.
920-
'IFRAME' !== $tag_name &&
921-
'NOEMBED' !== $tag_name &&
922-
'NOFRAMES' !== $tag_name &&
923-
'STYLE' !== $tag_name &&
924-
'XMP' !== $tag_name
925-
) {
926-
return true;
927-
}
928911

929912
/*
930913
* Preserve the opening tag pointers, as these will be overwritten
@@ -938,7 +921,7 @@ public function next_token() {
938921
$attributes = $this->attributes;
939922
$duplicate_attributes = $this->duplicate_attributes;
940923

941-
// Find the closing tag.
924+
// Find the closing tag if necessary.
942925
$found_closer = false;
943926
switch ( $tag_name ) {
944927
case 'SCRIPT':
@@ -950,13 +933,28 @@ public function next_token() {
950933
$found_closer = $this->skip_rcdata( $tag_name );
951934
break;
952935

936+
/*
937+
* In the browser this list would include the NOSCRIPT element,
938+
* but the Tag Processor is an environment with the scripting
939+
* flag disabled, meaning that it needs to descend into the
940+
* NOSCRIPT element to be able to properly process what will be
941+
* sent to a browser.
942+
*
943+
* Note that this rule makes HTML5 syntax incompatible with XML,
944+
* because the parsing of this token depends on client application.
945+
* The NOSCRIPT element cannot be represented in the XHTML syntax.
946+
*/
953947
case 'IFRAME':
954948
case 'NOEMBED':
955949
case 'NOFRAMES':
956950
case 'STYLE':
957951
case 'XMP':
958952
$found_closer = $this->skip_rawtext( $tag_name );
959953
break;
954+
955+
// No other tags should be treated in their entirety here.
956+
default:
957+
return true;
960958
}
961959

962960
if ( ! $found_closer ) {

0 commit comments

Comments
 (0)