Skip to content

Commit

Permalink
Whitespace and small notes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell committed Dec 10, 2023
1 parent 5d3e3ad commit 713e230
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions src/wp-includes/html-api/class-wp-html-tag-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@
* double-quoted strings, meaning that attributes on input with single-quoted or
* unquoted values will appear in the output with double-quotes.
*
* scripts aren't processed
*
* @since 6.2.0
* @since 6.2.1 Fix: Support for various invalid comments; attribute updates are case-insensitive.
* @since 6.3.2 Fix: Skip HTML-like content inside rawtext elements such as STYLE.
Expand Down Expand Up @@ -646,8 +648,8 @@ public function next_tag( $query = null ) {
}

public function next_token() {
$was_at = $this->bytes_already_parsed;
$this->get_updated_html();
$was_at = $this->bytes_already_parsed;

// Don't proceed if there's nothing more to scan.
if (
Expand All @@ -671,7 +673,7 @@ public function next_token() {
// Find the next tag if it exists.
if ( false === $this->parse_next_tag() ) {
if ( self::STATE_INCOMPLETE === $this->parser_state ) {
$this->bytes_already_parsed = $was_at;
$this->bytes_already_parsed = $was_at;
}

return false;
Expand All @@ -687,6 +689,7 @@ public function next_token() {
self::STATE_INCOMPLETE === $this->parser_state ||
$this->bytes_already_parsed >= strlen( $this->html )
) {
// Does this appropriately clear state (parsed attributes)?
$this->parser_state = self::STATE_INCOMPLETE;
$this->bytes_already_parsed = $was_at;

Expand All @@ -713,41 +716,41 @@ public function next_token() {
if (
! $this->is_closing_tag &&
(
'i' === $t || 'I' === $t ||
'n' === $t || 'N' === $t ||
's' === $t || 'S' === $t ||
't' === $t || 'T' === $t ||
'x' === $t || 'X' === $t
'i' === $t || 'I' === $t ||
'n' === $t || 'N' === $t ||
's' === $t || 'S' === $t ||
't' === $t || 'T' === $t ||
'x' === $t || 'X' === $t
) ) {
$tag_name = $this->get_tag();

if ( 'SCRIPT' === $tag_name && ! $this->skip_script_data() ) {
$this->parser_state = self::STATE_INCOMPLETE;
$this->bytes_already_parsed = $was_at;
$this->parser_state = self::STATE_INCOMPLETE;
$this->bytes_already_parsed = $was_at;

return false;
return false;
} elseif (
( 'TEXTAREA' === $tag_name || 'TITLE' === $tag_name ) &&
! $this->skip_rcdata( $tag_name )
( 'TEXTAREA' === $tag_name || 'TITLE' === $tag_name ) &&
! $this->skip_rcdata( $tag_name )
) {
$this->parser_state = self::STATE_INCOMPLETE;
$this->bytes_already_parsed = $was_at;
$this->parser_state = self::STATE_INCOMPLETE;
$this->bytes_already_parsed = $was_at;

return false;
return false;
} elseif (
(
'IFRAME' === $tag_name ||
'NOEMBED' === $tag_name ||
'NOFRAMES' === $tag_name ||
'STYLE' === $tag_name ||
'XMP' === $tag_name
) &&
! $this->skip_rawtext( $tag_name )
(
'IFRAME' === $tag_name ||
'NOEMBED' === $tag_name ||
'NOFRAMES' === $tag_name ||
'STYLE' === $tag_name ||
'XMP' === $tag_name
) &&
! $this->skip_rawtext( $tag_name )
) {
$this->parser_state = self::STATE_INCOMPLETE;
$this->bytes_already_parsed = $was_at;
$this->parser_state = self::STATE_INCOMPLETE;
$this->bytes_already_parsed = $was_at;

return false;
return false;
}
}

Expand Down

0 comments on commit 713e230

Please sign in to comment.