Make WordPress Core

Opened 14 years ago

Closed 13 years ago

#22476 closed enhancement (fixed)

Standardize single and double quotes in CSS url()s

Reported by: TobiasBg Owned by: nacin
Priority: low Milestone: 3.9
Component: Administration Version:
Severity: trivial Keywords: has-patch
Cc: Focuses: ui

Description (last modified by TobiasBg)

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 (8)

22476-remove-quotes-in-url.diff​ (22.3 KB ) - added by TobiasBg 14 years ago.
Patch removes optional ' and " in CSS url()s
22476.2.diff​ (28.7 KB ) - added by MikeHansenMe 14 years ago.
Add double quotes for consistency
22476.3.diff​ (26.7 KB ) - added by MikeHansenMe 14 years ago.
updated for new inconsistent styles
22476.4.diff​ (31.3 KB ) - added by MikeHansenMe 14 years ago.
updated patch
22476.none.diff​ (18.6 KB ) - added by MikeHansenMe 14 years ago.
patch without quotes
22476.none.2.diff​ (18.7 KB ) - added by MikeHansenMe 14 years ago.
Rechecked and refreshed for current trunk(3.6-beta2-24227)
22476.none.3.diff​ (68.1 KB ) - added by TobiasBg 13 years ago.
Refresh after [27167]
22476.none.4.diff​ (70.6 KB ) - added by TobiasBg 13 years ago.
Refreshed patch after wp-admin.css split in [27195]

Download all attachments as: .zip

Change History (26)

@TobiasBg
14 years ago

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

#1 @MikeHansenMe
14 years ago

  • Severity normal → trivial

#2 @helenyhou
14 years 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

#3 @TobiasBg
14 years 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.

@MikeHansenMe
14 years ago

Add double quotes for consistency

#4 @georgestephanis
14 years ago

+1 for MikeHansenMe's patch and coding standards.

@MikeHansenMe
14 years ago

updated for new inconsistent styles

#5 @MikeHansenMe
14 years ago

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

#6 @SergeyBiryukov
14 years ago

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

#7 @MikeHansenMe
14 years 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.

#8 @SergeyBiryukov
14 years ago

  • Keywords commit added

#9 @helen
14 years 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.

@MikeHansenMe
14 years ago

patch without quotes

#10 @MikeHansenMe
14 years 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.

@MikeHansenMe
14 years ago

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

#11 @ocean90
13 years ago

  • Milestone 3.6 → Future Release

#12 @mercime
13 years ago

  • Cc mercijavier@… added

#13 @GaryJ
13 years ago

If this patch is refreshed (if necessary), it seems like an easy win.

#14 @TobiasBg
13 years ago

The recent commits for the new admin styling in 3.8 added some more inconsistency here :-(
They use single quotes in url(), while the ​CSS Coding Standards now use no quotes (in the example).
If somebody states what the current consensus is, I'll gladly refresh the patch for this ticket (best time would be 3.9-early for that, I guess).

#15 @TobiasBg
13 years ago

As the CSS coding standards don't use quotes, and as grunt-js-cssmin also removes them during the minification, I updated the patch to remove all quotes (as of r27167).

#16 @TobiasBg
13 years ago

  • Description modified (diff)

@TobiasBg
13 years ago

Refreshed patch after wp-admin.css split in [27195]

#17 @TobiasBg
13 years ago

  • Milestone Future Release → 3.9

#18 @nacin
13 years ago

  • Owner set to nacin
  • Resolution → fixed
  • Status new → closed

In 27289:

Remove unnecessary quotes from urls in CSS.

props TobiasBg.
fixes #22476.

Note: See TracTickets for help on using tickets.