Skip to content

Commit 713e230

Browse files
committed
Whitespace and small notes
1 parent 5d3e3ad commit 713e230

1 file changed

Lines changed: 29 additions & 26 deletions

File tree

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

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@
291291
* double-quoted strings, meaning that attributes on input with single-quoted or
292292
* unquoted values will appear in the output with double-quotes.
293293
*
294+
* scripts aren't processed
295+
*
294296
* @since 6.2.0
295297
* @since 6.2.1 Fix: Support for various invalid comments; attribute updates are case-insensitive.
296298
* @since 6.3.2 Fix: Skip HTML-like content inside rawtext elements such as STYLE.
@@ -646,8 +648,8 @@ public function next_tag( $query = null ) {
646648
}
647649

648650
public function next_token() {
649-
$was_at = $this->bytes_already_parsed;
650651
$this->get_updated_html();
652+
$was_at = $this->bytes_already_parsed;
651653

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

677679
return false;
@@ -687,6 +689,7 @@ public function next_token() {
687689
self::STATE_INCOMPLETE === $this->parser_state ||
688690
$this->bytes_already_parsed >= strlen( $this->html )
689691
) {
692+
// Does this appropriately clear state (parsed attributes)?
690693
$this->parser_state = self::STATE_INCOMPLETE;
691694
$this->bytes_already_parsed = $was_at;
692695

@@ -713,41 +716,41 @@ public function next_token() {
713716
if (
714717
! $this->is_closing_tag &&
715718
(
716-
'i' === $t || 'I' === $t ||
717-
'n' === $t || 'N' === $t ||
718-
's' === $t || 'S' === $t ||
719-
't' === $t || 'T' === $t ||
720-
'x' === $t || 'X' === $t
719+
'i' === $t || 'I' === $t ||
720+
'n' === $t || 'N' === $t ||
721+
's' === $t || 'S' === $t ||
722+
't' === $t || 'T' === $t ||
723+
'x' === $t || 'X' === $t
721724
) ) {
722725
$tag_name = $this->get_tag();
723726

724727
if ( 'SCRIPT' === $tag_name && ! $this->skip_script_data() ) {
725-
$this->parser_state = self::STATE_INCOMPLETE;
726-
$this->bytes_already_parsed = $was_at;
728+
$this->parser_state = self::STATE_INCOMPLETE;
729+
$this->bytes_already_parsed = $was_at;
727730

728-
return false;
731+
return false;
729732
} elseif (
730-
( 'TEXTAREA' === $tag_name || 'TITLE' === $tag_name ) &&
731-
! $this->skip_rcdata( $tag_name )
733+
( 'TEXTAREA' === $tag_name || 'TITLE' === $tag_name ) &&
734+
! $this->skip_rcdata( $tag_name )
732735
) {
733-
$this->parser_state = self::STATE_INCOMPLETE;
734-
$this->bytes_already_parsed = $was_at;
736+
$this->parser_state = self::STATE_INCOMPLETE;
737+
$this->bytes_already_parsed = $was_at;
735738

736-
return false;
739+
return false;
737740
} elseif (
738-
(
739-
'IFRAME' === $tag_name ||
740-
'NOEMBED' === $tag_name ||
741-
'NOFRAMES' === $tag_name ||
742-
'STYLE' === $tag_name ||
743-
'XMP' === $tag_name
744-
) &&
745-
! $this->skip_rawtext( $tag_name )
741+
(
742+
'IFRAME' === $tag_name ||
743+
'NOEMBED' === $tag_name ||
744+
'NOFRAMES' === $tag_name ||
745+
'STYLE' === $tag_name ||
746+
'XMP' === $tag_name
747+
) &&
748+
! $this->skip_rawtext( $tag_name )
746749
) {
747-
$this->parser_state = self::STATE_INCOMPLETE;
748-
$this->bytes_already_parsed = $was_at;
750+
$this->parser_state = self::STATE_INCOMPLETE;
751+
$this->bytes_already_parsed = $was_at;
749752

750-
return false;
753+
return false;
751754
}
752755
}
753756

0 commit comments

Comments
 (0)