Skip to content

Commit

Permalink
Prevent mutating feature selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Dec 1, 2023
1 parent eb88cc1 commit 144c52e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ function scopeFeatureSelectors( scope, selectors ) {
return;
}

const featureSelectors = { ...selectors };
const featureSelectors = JSON.parse( JSON.stringify( selectors ) );

Object.entries( selectors ).forEach( ( [ feature, selector ] ) => {
if ( typeof selector === 'string' ) {
Expand Down Expand Up @@ -948,6 +948,7 @@ export const toStyles = (
baseSelector,
styleVariationSelector
);

const rules =
declarations.join( ';' );
ruleset += `${ cssSelector }{${ rules };}`;
Expand Down

0 comments on commit 144c52e

Please sign in to comment.