Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#28065 closed defect (bug) (duplicate)

<style type='text/css'> should be <style scoped> in wp-includes/media.php

Reported by: la-geek's profile La Geek Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: Gallery Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

You can't see it in theme "twenty fourteen". But if you activate e.g. genesis, you'll get a valdiation error -> "Element style is missing required attribute scoped."

This error is a result of line 1015 in wp-includes/media.php of WP 3.9 final version

if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) {
		$gallery_style = "
		<style type='text/css'>
			#{$selector} {
				margin: auto;
			}

Change <style type='text/css'> to <style scoped> and the validation error is fixed. More informations -> http://html5doctor.com/the-scoped-attribute/

I would apply a patch, if I would know, how to do this here. This here is not github. And on github I pulled wp 4.0, for this I could do a patch. But I guess here is another tracking and subversion system so I am lost. However it is only one line, that must be changed, so no big deal also without a patch of mine :)

Change History (7)

#1 in reply to: ↑ description @La Geek
11 years ago

Replying to La Geek:

Sorry, I forgot to mention, that this error appears with inserted gallery.

#2 @sabreuse
11 years ago

<style scoped> is currently Firefox only, with 13% browser support. Suggest holding off on this until it becomes clear that other browsers will be supporting it.

#3 @La Geek
11 years ago

Sorry for my typo, it's named scoped and not scope.

Sabreuse, you are totally right, therefore I wrote the link of html5doctor, where you can read the same. More then this the article contains a workaround/link "jQuery Scoped CSS plugin". Something like a polyfill.

It's no good practise to get W3C errors. The best way would be, to avoid inline styles. But I don't know, why they exist at all in media.php - so I can't judge it.

#4 @SergeyBiryukov
11 years ago

  • Component changed from Media to Gallery
  • Description modified (diff)
  • Summary changed from <style type='text/css'> should be <style scope> in wp-includes media.php to <style type='text/css'> should be <style scoped> in wp-includes/media.php

#5 @MikeHansenMe
11 years ago

As @sabreuse said this is still very limited. Here is the caniuse link.

http://caniuse.com/style-scoped

#6 @nacin
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Because HTML5 gallery support in 3.9 removes this inline style, I think this is a wontfix.

#7 @SergeyBiryukov
10 years ago

  • Resolution changed from wontfix to duplicate

Duplicate of #10734.

Note: See TracTickets for help on using tickets.