Skip to content

Commit

Permalink
HTML API: Stop counting noop seek operations against the max seek count.
Browse files Browse the repository at this point in the history
Co-authored-by: Weston Ruter <westonruter@git.wordpress.org>
  • Loading branch information
dmsnell and westonruter committed Sep 18, 2024
1 parent 5168e19 commit ad75ad5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/wp-includes/html-api/class-wp-html-tag-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2548,6 +2548,15 @@ public function seek( $bookmark_name ): bool {
return false;
}

$existing_bookmark = $this->bookmarks[ $bookmark_name ];

if (
$this->token_starts_at === $existing_bookmark->start &&
$this->token_length === $existing_bookmark->length
) {
return true;
}

if ( ++$this->seek_count > static::MAX_SEEK_OPS ) {
_doing_it_wrong(
__METHOD__,
Expand Down

0 comments on commit ad75ad5

Please sign in to comment.