wp-includes/class-wp-theme-json.php:1612Splits a selector list into separate selectors.
$selectorstringstring[] protected static function split_selector_list( $selector ): array { if ( ! str_contains( $selector, ',' ) ) { // See note on trimming CSS whitespace in main loop. return array( trim( $selector, " \t\n" ) ); } $selectors = array(); $selector_length = strlen( $selector ); $parentheses_depth = 0; $at = 0; $was_at = 0; while ( $at < $selector_length ) { $next_at = $at + strcspn( $selector, '/,\'"()<-\\', $at ); if ( $next_at >= $selector_length ) { break; } $next_cp = $selector[ $next_at ]; // Escaped syntax characters do not act as delimiters. if ( '\\' === $next_cp ) { $at = min( $next_at + 2, $selector_length ); continue; } /* * Start of a parenthesized expression, which maintains a stack of parentheses. * For the sake of this function, no selector list will be split inside parentheses. * Therefore it’s possible to jump ahead until this list completes. */ if ( '(' === $next_cp || ')' === $next_cp ) { $parentheses_depth += '(' === $next_cp ? 1 : -1; $at = $next_at + 1; continue; } // Start of a string, which will be incorporated into the selector in which it’s found. if ( "'" === $next_cp || '"' === $next_cp ) { $end_of_string = $next_at + 1; while ( $end_of_string < $selector_length ) { $end_of_string += strcspn( $selector, "{$next_cp}\\", $end_of_string ); if ( $end_of_string >= $selector_length ) { break; } $end_cp = $selector[ $end_of_string ]; // Skip escaped characters. if ( '\\' === $end_cp ) { $end_of_string = $end_of_string + 2; continue; } if ( $next_cp === $end_cp ) { ++$end_of_string; break; } ++$end_of_string; } $at = $end_of_string; continue; } // Start of a comment, which will be incorporated into the selector in which it’s found. if ( '/' === $next_cp && ( $next_at + 1 ) < $selector_length && '*' === $selector[ $next_at + 1 ] ) { $comment_end_at = strpos( $selector, '*/', $next_at + 1 ); $is_terminated = false !== $comment_end_at; $after_comment = $is_terminated ? $comment_end_at + 2 : strlen( $selector ); $at = $after_comment; continue; } // Start of a CDO or CDC, which will be incorporated into the selector in which it’s found. if ( ( '<' === $next_cp && 0 === substr_compare( $selector, '<!--', $next_at, 4 ) ) || ( '-' === $next_cp && 0 === substr_compare( $selector, '-->', $next_at, 3 ) ) ) {Introduced in 7.1.0.
Signature, return type and hooks compared across 1 parsed release.
src/wp-includes/class-wp-theme-json.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.