[wp-trac] [WordPress Trac] #30579: wp_enqueue_style in footer

WordPress Trac noreply at wordpress.org
Mon Jun 15 19:53:11 UTC 2020


#30579: wp_enqueue_style in footer
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:
                                                 |  kevdotbadger
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:
Component:  Script Loader                        |     Version:  2.6
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing reporter-    |     Focuses:  template,
  feedback close                                 |  performance
-------------------------------------------------+-------------------------
Changes (by westonruter):

 * keywords:  has-patch needs-testing reporter-feedback => has-patch needs-
     testing reporter-feedback close


Comment:

 A lot changes in 6 years.

 Adding an external stylesheet via `link` in the body is not invalid HTML
 anymore. Refer to [https://developer.mozilla.org/en-
 US/docs/Web/HTML/Element/link MDN docs]:

 > A `<link>` element can occur either in the `<head>` or `<body>` element,
 depending on whether it has a link type that is body-ok. For example, the
 `stylesheet` link type is body-ok, and therefore `<link rel="stylesheet">`
 is permitted in the body. […]

 Refer also to the HTML spec which states that `stylesheet` links are
 [https://html.spec.whatwg.org/multipage/links.html#body-ok body-ok].

 Try also running this HTML document through the
 [https://validator.w3.org/nu/ HTML validator]:

 {{{
 <!DOCTYPE html>
 <html lang="en">
   <head>
     <title>Foo</title>
   </head>
   <body>
     <link rel="stylesheet" href="/foo.css">
   </body>
 </html>
 }}}

 This results in:

 > Document checking completed. No errors or warnings to show.

 Putting stylesheet links in the body has also been called
 [https://jakearchibald.com/2016/link-in-body/ the future of loading CSS].

 I suggest closing this as being now invalid.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/30579#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list