[wp-trac] [WordPress Trac] #25899: Adding mediaelement CSS links outside of head tags breaks HTML5 validation

WordPress Trac noreply at wordpress.org
Sat Nov 9 18:15:34 UTC 2013


#25899: Adding mediaelement CSS links outside of head tags breaks HTML5 validation
--------------------------+-----------------------------
 Reporter:  AlphaK        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  3.6
 Severity:  minor         |   Keywords:
--------------------------+-----------------------------
 Medialement CSS links are added by default outside of the head element.

 It seems to come from /wp-includes/class.wp-styles.php:
 {{{
         function do_footer_items() { // HTML 5 allows styles in the body,
 grab late enqueued items and output them in the footer.
                 $this->do_items(false, 1);
                 return $this->done;
         }
 }}}

 Indeed style elements are allowed in the body in HTML5, provided it is a
 '''style''' element - not link element - and provided it has the scoped
 attribute. See http://www.w3.org/TR/2011/WD-html5-author-20110705/the-
 style-element.html#the-style-element

 Here are the medialements genetared tags in the body:
 {{{
 <link rel='stylesheet' id='mediaelement-css'  href='http://mydomain/wp-
 includes/js/mediaelement/mediaelementplayer.min.css?ver=2.13.0'
 type='text/css' media='all' />
 <link rel='stylesheet' id='wp-mediaelement-css'  href='http://mydomain/wp-
 includes/js/mediaelement/wp-mediaelement.css?ver=3.7.1' type='text/css'
 media='all' />
 }}}

 But this breaks W3C's HTML5 validation.

 According to http://www.w3.org/TR/2011/WD-html5-author-20110705/the-link-
 element.html :
 Link elements must be used in metadata content.

 According to http://www.whatwg.org/specs/web-apps/current-
 work/multipage/semantics.html#the-link-element :
 If the rel attribute is used, the element is restricted to the head
 element. When used with the itemprop attribute, the element can be used
 both in the head element and in the body of the page, subject to the
 constraints of the microdata model.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25899>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list