Commit e45892b
committed
Editor: Fix
The `wp_get_elements_class_name()` function previously generated CSS class names by hashing the serialized block data via `md5()`. Identical blocks received the same `wp-elements-*` class name and the Style Engine deduplicated their CSS rules into one, causing a parent block's element style (e.g. link color) to cascade down and override a child block's identical style due to CSS source order.
The function is updated to use `wp_unique_prefixed_id()` instead, generating sequential unique class names (`wp-elements-1`, `wp-elements-2`, etc.) that match the block editor's JavaScript implementation. The now-unused `$parsed_block` parameter is removed from the function signature.
PHPStan rule level 10 errors are also resolved in the related code. See #64898.
Developed in WordPress/wordpress-develop#12126.
Follow-up to r53260, r58074.
Props tusharbharti, westonruter, wildworks.
Fixes #65435.
Built from https://develop.svn.wordpress.org/trunk@62520
git-svn-id: http://core.svn.wordpress.org/trunk@61801 1a063a9b-81f0-0310-95a4-ce76da25c4cdwp-elements-* CSS class name collisions for identical blocks.1 parent 73f8bbb commit e45892b
2 files changed
Lines changed: 33 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
109 | 108 | | |
110 | 109 | | |
111 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
112 | 134 | | |
113 | 135 | | |
114 | 136 | | |
| |||
129 | 151 | | |
130 | 152 | | |
131 | 153 | | |
132 | | - | |
133 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
134 | 158 | | |
| 159 | + | |
135 | 160 | | |
136 | 161 | | |
137 | 162 | | |
| |||
157 | 182 | | |
158 | 183 | | |
159 | 184 | | |
160 | | - | |
| 185 | + | |
161 | 186 | | |
162 | 187 | | |
163 | 188 | | |
| |||
197 | 222 | | |
198 | 223 | | |
199 | 224 | | |
200 | | - | |
| 225 | + | |
201 | 226 | | |
202 | 227 | | |
203 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
0 commit comments