Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional CSS: Add code comments contextualising tranformStyles for clarity #60267

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ export default function AdvancedPanel( {
css: newValue,
} );
if ( cssError ) {
// Check if the new value is valid CSS, and pass a wrapping selector
// to ensure that `transformStyles` validates the CSS. Note that the
// wrapping selector here is not used in the actual output of any styles.
const [ transformed ] = transformStyles(
[ { css: newValue } ],
'.editor-styles-wrapper'
'.for-validation-only'
);
if ( transformed ) {
setCSSError( null );
Expand All @@ -43,9 +46,12 @@ export default function AdvancedPanel( {
return;
}

// Check if the new value is valid CSS, and pass a wrapping selector
// to ensure that `transformStyles` validates the CSS. Note that the
// wrapping selector here is not used in the actual output of any styles.
const [ transformed ] = transformStyles(
[ { css: event.target.value } ],
'.editor-styles-wrapper'
'.for-validation-only'
);

setCSSError(
Expand Down
Loading