WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 3 weeks ago

#22476 new enhancement

Standardize single and double quotes in CSS url()s

Reported by: TobiasBg Owned by:
Priority: low Milestone: Future Release
Component: Administration Version:
Severity: trivial Keywords: has-patch ui-focus
Cc: mdhansen@…

Description

As per http://www.w3.org/TR/CSS2/syndata.html#value-def-uri (and other locations), single quotes ' and double quotes " in url() values in CSS like

body { background: url("../img/image,gif");

are optional. Most of core's CSS is already written without such quotes. The patch 22476-remove-quotes-in-url.diff removes the remaining ones, for consistency and to save us some bytes again, even in the minified CSS.

Attachments (6)

22476-remove-quotes-in-url.diff (22.3 KB) - added by TobiasBg 7 months ago.
Patch removes optional ' and " in CSS url()s
22476.2.diff (28.7 KB) - added by MikeHansenMe 7 months ago.
Add double quotes for consistency
22476.3.diff (26.7 KB) - added by MikeHansenMe 4 months ago.
updated for new inconsistent styles
22476.4.diff (31.3 KB) - added by MikeHansenMe 2 months ago.
updated patch
22476.none.diff (18.6 KB) - added by MikeHansenMe 2 months ago.
patch without quotes
22476.none.2.diff (18.7 KB) - added by MikeHansenMe 6 weeks ago.
Rechecked and refreshed for current trunk(3.6-beta2-24227)

Download all attachments as: .zip

Change History (17)

TobiasBg7 months ago

Patch removes optional ' and " in CSS url()s

comment:1 MikeHansenMe7 months ago

  • Severity changed from normal to trivial

comment:2 helenyhou7 months ago

Our CSS coding standards have double quotes listed as the style. Personal preferences aside, these decisions came out of long and arduous group discussions. Also, there's already a ticket for CSS standards cleanup: #20570

comment:3 TobiasBg7 months ago

Personally, I don't actually prefer the without-quotes version either. I justed wanted some consistency, and as quotes are optional, and as recent commits with new CSS also left them out, additionally to a lot of url()s already being without them, I decided to go that way in the patch.

It might indeed be better to add " everywhere, according to the Coding Standards, and then maybe hope that the CSS minifier will someday automatically strip them to save the bytes in the .min.css version.

MikeHansenMe7 months ago

Add double quotes for consistency

comment:4 georgestephanis7 months ago

+1 for MikeHansenMe's patch and coding standards.

MikeHansenMe4 months ago

updated for new inconsistent styles

comment:5 MikeHansenMe4 months ago

Added a new patch because there has been new css added that is also inconsistent. Hope this can go into 3.6

comment:6 SergeyBiryukov4 months ago

  • Component changed from General to Administration
  • Keywords ui-focus added
  • Milestone changed from Awaiting Review to 3.6
  • Priority changed from normal to low
  • Summary changed from Remove optional single and double quotes in CSS url()s to Standardize single and double quotes in CSS url()s

MikeHansenMe2 months ago

updated patch

comment:7 MikeHansenMe2 months ago

  • Cc mdhansen@… added

I think now would be a good time to get this patch in since all the features are now in beta. Once all the css has a standard it will be easier to monitor new patches for this standard.

comment:8 SergeyBiryukov2 months ago

  • Keywords commit added

comment:9 helen2 months ago

  • Keywords commit removed

Hate to do this to you - we (I?) ended up changing the coding standards after all about a month ago: http://make.wordpress.org/core/handbook/coding-standards/css/#values

Use double quotes rather than single quotes, and only when needed, such as when a font name has a space.

I can't quite recall what prompted that change - will link if I have a chance to dig it up.

MikeHansenMe2 months ago

patch without quotes

comment:10 MikeHansenMe2 months ago

So it seems like the preferred way is without quotes unless necessary. I really do not mind which we use, only that it is consistent. However, the coding standard has been double quotes up until recently. Any users who have adopted double will now be non-standard.

MikeHansenMe6 weeks ago

Rechecked and refreshed for current trunk(3.6-beta2-24227)

comment:11 ocean903 weeks ago

  • Milestone changed from 3.6 to Future Release
Note: See TracTickets for help on using tickets.