Skip to content

Commit ccd90d0

Browse files
committed
Adjust some CSS formatting
* Add second colon for `::before` * Add spaces around `>` * Remove blank line between two groups of rules
1 parent 0693d23 commit ccd90d0

3 files changed

Lines changed: 14 additions & 16 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Note compatibility through WP 5.4+
1313
* Drop compatibility with version of WP older than 4.9
1414
* New: Add TODO.md and move existing TODO list from top of main plugin file into it
15+
* Change: Adjust some CSS formatting (add second colon for `::before` and spaces around `>`)
1516
* Change: Adjust output spacing for CSS
1617
* Change: Note compatibility through WP 5.4+
1718
* Change: Drop compatibility for version of WP older than 4.9

‎admin-trim-interface.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,16 +357,16 @@ public function add_css() {
357357
// Remove the home icon from admin bar.
358358
if ( $options['hide_home_icon'] ) {
359359
if ( is_admin() ){
360-
$extra_css .= '.wp-admin #wpwrap #wpadminbar #wp-admin-bar-site-name>.ab-item:before { content: ""; }' . "\n";
360+
$extra_css .= '.wp-admin #wpwrap #wpadminbar #wp-admin-bar-site-name > .ab-item::before { content: ""; }' . "\n";
361361
} else {
362-
$extra_css .= 'body #wpadminbar #wp-admin-bar-site-name>.ab-item:before { content: ""; }' . "\n";
362+
$extra_css .= 'body #wpadminbar #wp-admin-bar-site-name > .ab-item::before { content: ""; }' . "\n";
363363
}
364364
}
365365

366366
// Remove the user icon from admin bar.
367367
if ( $options['hide_avatar'] ) {
368368
$css[] = 'body #wp-admin-bar-user-info .avatar';
369-
$extra_css .= 'body #wp-admin-bar-my-account>.ab-item:before { content: ""; }' . "\n";
369+
$extra_css .= 'body #wp-admin-bar-my-account > .ab-item::before { content: ""; }' . "\n";
370370
}
371371

372372
}
@@ -387,7 +387,7 @@ public function add_css() {
387387
if ( $css || $extra_css ) {
388388
$css = implode( ', ', $css );
389389
if ( $css ) {
390-
$css = "$css { display:none; }\n";
390+
$css = "$css { display: none; }";
391391
}
392392

393393
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';

‎tests/test-admin-trim-interface.php‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,10 @@ public function test_add_css_with_everything_enabled_and_non_admin_and_admin_bar
232232
) );
233233

234234
$expected = '<style>
235-
body #wp-admin-bar-user-info .avatar { display:none; }
236-
235+
body #wp-admin-bar-user-info .avatar { display: none; }
237236
body #wpadminbar #wp-admin-bar-my-sites > .ab-item::before { content: ""; }
238-
body #wpadminbar #wp-admin-bar-site-name>.ab-item:before { content: ""; }
239-
body #wp-admin-bar-my-account>.ab-item:before { content: ""; }
237+
body #wpadminbar #wp-admin-bar-site-name > .ab-item::before { content: ""; }
238+
body #wp-admin-bar-my-account > .ab-item::before { content: ""; }
240239
241240
</style>' . "\n";
242241

@@ -252,11 +251,10 @@ public function test_add_css_with_everything_enabled_and_admin_but_not_on_plugin
252251
) );
253252

254253
$expected = '<style>
255-
body #wp-admin-bar-user-info .avatar { display:none; }
256-
254+
body #wp-admin-bar-user-info .avatar { display: none; }
257255
.wp-admin #wpwrap #wpadminbar #wp-admin-bar-my-sites > .ab-item::before { content: ""; }
258-
.wp-admin #wpwrap #wpadminbar #wp-admin-bar-site-name>.ab-item:before { content: ""; }
259-
body #wp-admin-bar-my-account>.ab-item:before { content: ""; }
256+
.wp-admin #wpwrap #wpadminbar #wp-admin-bar-site-name > .ab-item::before { content: ""; }
257+
body #wp-admin-bar-my-account > .ab-item::before { content: ""; }
260258
261259
</style>' . "\n";
262260

@@ -272,11 +270,10 @@ public function test_add_css_with_everything_enabled_and_on_plugin_settings_page
272270
) );
273271

274272
$expected = '<style>
275-
body #wp-admin-bar-user-info .avatar { display:none; }
276-
273+
body #wp-admin-bar-user-info .avatar { display: none; }
277274
.wp-admin #wpwrap #wpadminbar #wp-admin-bar-my-sites > .ab-item::before { content: ""; }
278-
.wp-admin #wpwrap #wpadminbar #wp-admin-bar-site-name>.ab-item:before { content: ""; }
279-
body #wp-admin-bar-my-account>.ab-item:before { content: ""; }
275+
.wp-admin #wpwrap #wpadminbar #wp-admin-bar-site-name > .ab-item::before { content: ""; }
276+
body #wp-admin-bar-my-account > .ab-item::before { content: ""; }
280277
.c2c-ati-image { position: absolute; left: 400px; }
281278
.appearance_page_admin-trim-interface-admin-trim-interface .form-table th { width: 300px; }
282279
.appearance_page_admin-trim-interface-admin-trim-interface .c2c-form .form-table tr:first-child { position: absolute; }

0 commit comments

Comments
 (0)