What problem does this address?
gutenberg_render_position_support() builds its container class from a per-request counter:
<?php
$class_name = wp_unique_id( 'wp-container-' );
Every block instance with position support therefore gets its own class and its own rule in the block-supports style engine store, even when the resulting CSS is byte-for-byte identical.
The other block supports that emit a scoped rule derive the class from the style inputs, so identical styles collapse into one rule:
|
$class_name = wp_unique_id_from_values( $parsed_block, 'wp-custom-css-' ); |
Impact
With 200 Group blocks that all use position: sticky; top: 0px:
|
Rules in store |
Generated CSS |
| trunk |
200 |
22,092 bytes |
| patched |
1 |
116 bytes |
This CSS is inlined into every front-end response, so the duplication adds page weight on every request, on top of the render cost.
WordPree core trac ticket: https://core.trac.wordpress.org/ticket/66200
What problem does this address?
gutenberg_render_position_support()builds its container class from a per-request counter:Every block instance with position support therefore gets its own class and its own rule in the
block-supportsstyle engine store, even when the resulting CSS is byte-for-byte identical.The other block supports that emit a scoped rule derive the class from the style inputs, so identical styles collapse into one rule:
gutenberg/lib/block-supports/custom-css.php
Line 46 in bbbc103
Impact
With 200 Group blocks that all use
position: sticky; top: 0px:This CSS is inlined into every front-end response, so the duplication adds page weight on every request, on top of the render cost.
WordPree core trac ticket: https://core.trac.wordpress.org/ticket/66200