Commit 2f4e215f47 for wordpress.org

commit 2f4e215f4775f06ce98093eaf51a51d4351c61a3
Author: jonsurrell <jonsurrell@git.wordpress.org>
Date:   Mon Oct 19 05:45:47 2026 +0000

    HTML API: Simplify the `class_list()` loop.

    Developed in: https://github.com/WordPress/wordpress-develop/pull/8076

    Props jonsurrell, mukesh27, peterwilsoncc, westonruter.
    See #65846.

    Built from https://develop.svn.wordpress.org/trunk@64495


    git-svn-id: http://core.svn.wordpress.org/trunk@63645 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/html-api/class-wp-html-tag-processor.php b/wp-includes/html-api/class-wp-html-tag-processor.php
index afd4dca2c0..545af06503 100644
--- a/wp-includes/html-api/class-wp-html-tag-processor.php
+++ b/wp-includes/html-api/class-wp-html-tag-processor.php
@@ -1208,21 +1208,12 @@ class WP_HTML_Tag_Processor {

 		$is_quirks = self::QUIRKS_MODE === $this->compat_mode;

-		$at = 0;
-		while ( $at < strlen( $class ) ) {
-			// Skip past any initial boundary characters.
-			$at += strspn( $class, " \t\f\r\n", $at );
-			if ( $at >= strlen( $class ) ) {
-				return;
-			}
-
+		$at           = strspn( $class, " \t\f\r\n" );
+		$class_length = strlen( $class );
+		while ( $at < $class_length ) {
 			// Find the byte length until the next boundary.
 			$length = strcspn( $class, " \t\f\r\n", $at );
-			if ( 0 === $length ) {
-				return;
-			}
-
-			$name = substr( $class, $at, $length );
+			$name   = substr( $class, $at, $length );
 			if ( $is_quirks ) {
 				$name = strtolower( $name );
 			}
@@ -1233,12 +1224,12 @@ class WP_HTML_Tag_Processor {
 			 * Given this, it is probably faster overall to scan an array for a value rather
 			 * than to use the class name as a key and check if it's a key of $seen.
 			 */
-			if ( in_array( $name, $seen, true ) ) {
-				continue;
+			if ( ! in_array( $name, $seen, true ) ) {
+				$seen[] = $name;
+				yield $name;
 			}

-			$seen[] = $name;
-			yield $name;
+			$at += strspn( $class, " \t\f\r\n", $at );
 		}
 	}

diff --git a/wp-includes/version.php b/wp-includes/version.php
index 82999cc1f4..da503ff44c 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-64494';
+$wp_version = '7.2-alpha-64495';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.