Skip to content

Commit

Permalink
Remove early bailout of special elements. It's duplicated.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell committed Jan 12, 2024
1 parent 8793d47 commit 4639ff8
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/wp-includes/html-api/class-wp-html-tag-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -908,23 +908,6 @@ public function next_token() {
}

$tag_name = $this->get_tag();
if (
// Skips SCRIPT data.
'SCRIPT' !== $tag_name &&

// Skips RCDATA data.
'TEXTAREA' !== $tag_name &&
'TITLE' !== $tag_name &&

// Skips RAWTEXT data.
'IFRAME' !== $tag_name &&
'NOEMBED' !== $tag_name &&
'NOFRAMES' !== $tag_name &&
'STYLE' !== $tag_name &&
'XMP' !== $tag_name
) {
return true;
}

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

// Find the closing tag.
// Find the closing tag if necessary.
$found_closer = false;
switch ( $tag_name ) {
case 'SCRIPT':
Expand All @@ -950,13 +933,28 @@ public function next_token() {
$found_closer = $this->skip_rcdata( $tag_name );
break;

/*
* In the browser this list would include the NOSCRIPT element,
* but the Tag Processor is an environment with the scripting
* flag disabled, meaning that it needs to descend into the
* NOSCRIPT element to be able to properly process what will be
* sent to a browser.
*
* Note that this rule makes HTML5 syntax incompatible with XML,
* because the parsing of this token depends on client application.
* The NOSCRIPT element cannot be represented in the XHTML syntax.
*/
case 'IFRAME':
case 'NOEMBED':
case 'NOFRAMES':
case 'STYLE':
case 'XMP':
$found_closer = $this->skip_rawtext( $tag_name );
break;

// No other tags should be treated in their entirety here.
default:
return true;
}

if ( ! $found_closer ) {
Expand Down

0 comments on commit 4639ff8

Please sign in to comment.