From 21ecbc3b0d611819bf35be78c1995d2e6739f1eb Mon Sep 17 00:00:00 2001 From: isabel_brison Date: Thu, 14 Sep 2023 04:56:21 +0000 Subject: [PATCH] Editor: disable default style engine optimisation. Stops style engine from combining CSS selectors by default so that rule order is preserved. Props ramonopoly, rajinsharwar, timdix, costdev, audrasjb, SergeyBiryukov, JeffPaul, mukesh27. Fixes #58811. Built from https://develop.svn.wordpress.org/trunk@56574 git-svn-id: http://core.svn.wordpress.org/trunk@56086 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/script-loader.php | 2 +- wp-includes/style-engine.php | 4 ++-- wp-includes/style-engine/class-wp-style-engine-processor.php | 5 +++-- wp-includes/style-engine/class-wp-style-engine.php | 2 +- wp-includes/version.php | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 27f5a3714c..adf309a12f 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -3053,7 +3053,7 @@ function wp_enqueue_block_support_styles( $style, $priority = 10 ) { * Default empty array. * * @type bool $optimize Whether to optimize the CSS output, e.g., combine rules. - * Default true. + * Default false. * @type bool $prettify Whether to add new lines and indents to output. * Default to whether the `SCRIPT_DEBUG` constant is defined. * } diff --git a/wp-includes/style-engine.php b/wp-includes/style-engine.php index 4a93d2cc5a..5b5545c85e 100644 --- a/wp-includes/style-engine.php +++ b/wp-includes/style-engine.php @@ -130,7 +130,7 @@ function wp_style_engine_get_styles( $block_styles, $options = array() ) { * e.g. 'block-supports' or 'global-styles'. Default 'block-supports'. * When set, the style engine will attempt to store the CSS rules. * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. - * Default true. + * Default false. * @type bool $prettify Whether to add new lines and indents to output. * Defaults to whether the `SCRIPT_DEBUG` constant is defined. * } @@ -178,7 +178,7 @@ function wp_style_engine_get_stylesheet_from_css_rules( $css_rules, $options = a * Optional. An array of options. Default empty array. * * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. - * Default true. + * Default false. * @type bool $prettify Whether to add new lines and indents to output. * Defaults to whether the `SCRIPT_DEBUG` constant is defined. * } diff --git a/wp-includes/style-engine/class-wp-style-engine-processor.php b/wp-includes/style-engine/class-wp-style-engine-processor.php index c603d1c509..0778748498 100644 --- a/wp-includes/style-engine/class-wp-style-engine-processor.php +++ b/wp-includes/style-engine/class-wp-style-engine-processor.php @@ -85,12 +85,13 @@ class WP_Style_Engine_Processor { * Gets the CSS rules as a string. * * @since 6.1.0 + * @since 6.4.0 The Optimization is no longer the default. * * @param array $options { * Optional. An array of options. Default empty array. * * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. - * Default true. + * Default false. * @type bool $prettify Whether to add new lines and indents to output. * Defaults to whether the `SCRIPT_DEBUG` constant is defined. * } @@ -98,7 +99,7 @@ class WP_Style_Engine_Processor { */ public function get_css( $options = array() ) { $defaults = array( - 'optimize' => true, + 'optimize' => false, 'prettify' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG, ); $options = wp_parse_args( $options, $defaults ); diff --git a/wp-includes/style-engine/class-wp-style-engine.php b/wp-includes/style-engine/class-wp-style-engine.php index bdaae4a1f7..da1afe42ca 100644 --- a/wp-includes/style-engine/class-wp-style-engine.php +++ b/wp-includes/style-engine/class-wp-style-engine.php @@ -624,7 +624,7 @@ final class WP_Style_Engine { * e.g. 'block-supports' or 'global-styles'. Default 'block-supports'. * When set, the style engine will attempt to store the CSS rules. * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. - * Default true. + * Default false. * @type bool $prettify Whether to add new lines and indents to output. * Defaults to whether the `SCRIPT_DEBUG` constant is defined. * } diff --git a/wp-includes/version.php b/wp-includes/version.php index 7a9eaef592..9ebf26b532 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56573'; +$wp_version = '6.4-alpha-56574'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.