Skip to content

Commit 7bdd459

Browse files
committed
Simplify whitspace splitting function
1 parent bc77597 commit 7bdd459

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/wp-includes/html-api/class-wp-css-attribute-selector.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,15 @@ public function matches( WP_HTML_Tag_Processor $processor ): bool {
7878
* @return Generator<string>
7979
*/
8080
private function whitespace_delimited_list( string $input ): Generator {
81+
// Start by skipping whitespace.
8182
$offset = strspn( $input, self::WHITESPACE_CHARACTERS );
8283

8384
while ( $offset < strlen( $input ) ) {
8485
// Find the byte length until the next boundary.
8586
$length = strcspn( $input, self::WHITESPACE_CHARACTERS, $offset );
86-
if ( 0 === $length ) {
87-
return;
88-
}
87+
$value = substr( $input, $offset, $length );
8988

90-
$value = substr( $input, $offset, $length );
89+
// Move past trailing whitespace.
9190
$offset += $length + strspn( $input, self::WHITESPACE_CHARACTERS, $offset + $length );
9291

9392
yield $value;

0 commit comments

Comments
 (0)