[wp-trac] [WordPress Trac] #38137: Add support to add attributes in wp_register_script() and wp_register_style()

WordPress Trac noreply at wordpress.org
Fri Sep 23 04:59:59 UTC 2016


#38137: Add support to add attributes in wp_register_script() and
wp_register_style()
-----------------------------+-----------------------------
 Reporter:  developersq      |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Both {{{<link>}}} and {{{<script>}}} tags support extra attributes to how
 and when to load the style or script.

 Current implementation of '''wp_register_script()/wp_enqueue_script()'''
 and '''wp_register_style()/wp_enqueue_style()''' do not have any option to
 add extra attributes.

 Most useful scenario to use this feature(s) in case of JavaScript
 {{{<script>}}} is to easily add 'async' or 'defer' attributes when needed.
 Also, in case of CSS {{{<link>}}},    ability to add 'media' and 'rel'
 attributes. Here, the use of 'rel' is really important to enhance the
 performance and user experience for the webpage.

 [https://developer.mozilla.org/en/docs/Web/HTML/Element/script]
 [https://developer.mozilla.org/en/docs/Web/HTML/Element/link]
 [http://www.w3schools.com/tags/att_link_rel.asp]

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38137>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list