wp-includes/block-supports/states.php:498Builds a scoped selector from a block selector and optional pseudo-state.
$base_selectorstring$block_selectorstring|null$statestringstringfunction wp_build_state_selector( $base_selector, $block_selector, $state ) { if ( ! is_string( $block_selector ) || '' === trim( $block_selector ) ) { return $base_selector . $state; } $selectors = wp_split_selector_list( $block_selector ); $scoped_selectors = array(); foreach ( $selectors as $selector ) { $selector = trim( $selector ); if ( '' === $selector ) { continue; } /* * Replace only the leading block selector part (e.g. class name, * attribute selector, ID, or tag name) with the block instance selector. * Preserve anything after that prefix, including modifier classes on the * same element and combinators without spaces. */ if ( preg_match( '/^([.#]?[-_a-zA-Z0-9]+|\[[^\]]+\])/', $selector, $matches ) ) { $scoped_selectors[] = $base_selector . substr( $selector, strlen( $matches[0] ) ) . $state; continue; } $scoped_selectors[] = $base_selector . $state; } return empty( $scoped_selectors ) ? $base_selector . $state : implode( ', ', $scoped_selectors );}Introduced in 7.1.0.
Signature, return type and hooks compared across 1 parsed release.
src/wp-includes/block-supports/states.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.