[wp-trac] [WordPress Trac] #22249: Add ability to set or remove attributes on enqueued scripts and styles.

WordPress Trac noreply at wordpress.org
Mon Feb 22 22:36:02 UTC 2016


#22249: Add ability to set or remove attributes on enqueued scripts and styles.
----------------------------------------+------------------------
 Reporter:  ryanve                      |       Owner:  chriscct7
     Type:  feature request             |      Status:  assigned
 Priority:  normal                      |   Milestone:  4.5
Component:  Script Loader               |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+------------------------

Comment (by ericlewis):

 Had a [https://wordpress.slack.com/archives/core/p1456175527000853 good
 chat with @boonebgorges] about the demerits of
 [https://core.trac.wordpress.org/ticket/22249#comment:22 refactoring our
 script loader to use an array hash].

 In attachment:22249.3.diff

 * Instead of changing `$in_footer` to an array hash, add a sixth argument
 for element attributes. Placing a script in the footer seems like a
 separate responsibility to think about when writing code.
 * Create separate methods on `WP_Scripts` for `get_script_attributes()`
 and `get_concatenated_script_attributes()`.
 * Add tests.

 Do we still want to offer a filter for script attributes now that its
 available on the register/enqueue functions?

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


More information about the wp-trac mailing list