WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#13056 closed defect (bug) (fixed)

Invalid HTML5: Generated CSS Link

Reported by: junquan Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9.2
Component: Formatting Keywords: has-patch
Focuses: Cc:

Description

The wp_head() function generates invalid HTML5 when adding an external CSS file created by a plugin.

Below is the code generated by wp_head() using the GD Star Rating plugin:

<link rel='stylesheet' id='gdsr_style_main-css' href='http://localhost/blog/wp-content/plugins/gd-star-rating/css/gdsr.css.php?t=1271711028&amp;s=a05i05m20k20c05r05%231624%2324%23s1poxygen%23lsgflower%23lsgfountain%23lsg&amp;o=off&#038;ver=1.8.8' type='text/css' media='' />

The plugin author insists this is a problem with Wordpress, not with the plugin.

The relevant error according to http://validator.w3.org/check:
"One or more media queries, combined in a comma-separated list. Each media query consists of a media type and zero or more expressions that check for the conditions of particular media features. A media type is one of the following: all, braille, embossed, handheld, print, projection, screen, speech, tty, or tv. Note: The aural media type is deprecated. For information about valid media features and about the exact syntax of media queries, see the Media Queries specification."

This can be corrected by, for example, changing the default value for media from empty (media=' ') to 'screen' (media='screen').

Attachments (1)

13056.1.patch (695 bytes) - added by koopersmith 4 years ago.

Download all attachments as: .zip

Change History (6)

koopersmith4 years ago

comment:1 koopersmith4 years ago

  • Keywords has-patch added

The default value in wp_enqueue_style was set to false. I changed it to 'all' (which is what wp_register_style currently uses).

That said, there are a few inconsistencies between wp_register_style and wp_enqueue_style. I'll open another ticket.

comment:3 F J Kaiser4 years ago

  • Cc 24-7@… added

+1

comment:4 nacin4 years ago

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

(In [14255]) Have media default to 'all', not false, in wp_enqueue_style. props koopersmith, fixes #13056.

comment:5 nacin4 years ago

  • Milestone changed from Unassigned to 3.0
Note: See TracTickets for help on using tickets.