Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#22476 closed enhancement (fixed)

Standardize single and double quotes in CSS url()s

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

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

Download all attachments as: .zip

Change History (26)

@TobiasBg
11 years ago

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

#1 @MikeHansenMe
11 years ago

  • Severity changed from normal to trivial

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

Add double quotes for consistency

#4 @georgestephanis
11 years ago

+1 for MikeHansenMe's patch and coding standards.

@MikeHansenMe
11 years ago

updated for new inconsistent styles

#5 @MikeHansenMe
11 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
11 years 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

@MikeHansenMe
11 years ago

updated patch

#7 @MikeHansenMe
11 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
11 years ago

  • Keywords commit added

#9 @helen
11 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
11 years ago

patch without quotes

#10 @MikeHansenMe
11 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
11 years ago

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

#11 @ocean90
11 years ago

  • Milestone changed from 3.6 to Future Release

#12 @mercime
11 years ago

  • Cc mercijavier@… added

#13 @GaryJ
11 years ago

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

#14 @TobiasBg
10 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).

@TobiasBg
10 years ago

Refresh after [27167]

#15 @TobiasBg
10 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
10 years ago

  • Description modified (diff)

@TobiasBg
10 years ago

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

#17 @TobiasBg
10 years ago

  • Milestone changed from Future Release to 3.9

#18 @nacin
10 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 27289:

Remove unnecessary quotes from urls in CSS.

props TobiasBg.
fixes #22476.

Note: See TracTickets for help on using tickets.