PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/style-engine/class-wp-style-engine-processor-gutenberg.php +17 -3 23.5.3 → trunk View file →
@@ -96,9 +96,9 @@
96 96 * Get the CSS rules as a string.
97 97 *
98 98 * Since 6.4.0 Optimization is no longer the default.
99 99 *
100 - * @param array $options {
100 + * @param array $options {
101 101 * Optional. An array of options. Default empty array.
102 102 *
103 103 * @type bool $optimize Whether to optimize the CSS output, e.g., combine rules. Default is `false`.
104 104 * @type bool $prettify Whether to add new lines and indents to output. Default is to inherit the value of the global constant `SCRIPT_DEBUG`, if it is defined.
@@ -141,11 +141,25 @@
141 141 private function combine_rules_selectors() {
142 142 // Build an array of selectors along with the JSON-ified styles to make comparisons easier.
143 143 $selectors_json = array();
144 144 foreach ( $this->css_rules as $rule ) {
145 - $declarations = $rule->get_declarations()->get_declarations();
145 + $declarations = $rule->get_declarations()->get_declarations();
146 + $declaration_options = $rule->get_declarations()->get_declaration_options();
146 147 ksort( $declarations );
147 - $selectors_json[ $rule->get_selector() ] = wp_json_encode( $declarations );
148 + // Declaration options are keyed by property and are part of the rule identity.
149 + ksort( $declaration_options );
150 + foreach ( $declaration_options as $property => $options ) {
151 + if ( is_array( $options ) ) {
152 + ksort( $options );
153 + $declaration_options[ $property ] = $options;
154 + }
155 + }
156 + $selectors_json[ $rule->get_selector() ] = wp_json_encode(
157 + array(
158 + 'declarations' => $declarations,
159 + 'declaration_options' => $declaration_options,
160 + )
161 + );
148 162 }
149 163
150 164 // Combine selectors that have the same styles.
151 165 foreach ( $selectors_json as $selector => $json ) {