Scopes the selectors for a given style node.
Description
This includes the primary selector, i.e. $node['selector'], as well as any custom selectors for features and subfeatures, e.g. $node['selectors']['border'] etc.
Parameters
$scopestringrequired- Selector to scope to.
$nodearrayrequired- Style node with selectors to scope.
Source
protected static function scope_style_node_selectors( $scope, $node ) {
$node['selector'] = static::scope_selector( $scope, $node['selector'] );
if ( empty( $node['selectors'] ) ) {
return $node;
}
foreach ( $node['selectors'] as $feature => $selector ) {
if ( is_string( $selector ) ) {
$node['selectors'][ $feature ] = static::scope_selector( $scope, $selector );
}
if ( is_array( $selector ) ) {
foreach ( $selector as $subfeature => $subfeature_selector ) {
$node['selectors'][ $feature ][ $subfeature ] = static::scope_selector( $scope, $subfeature_selector );
}
}
}
return $node;
}
Changelog
| Version | Description |
|---|---|
| 6.6.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.