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

WordPress Trac noreply at wordpress.org
Tue Feb 23 23:03:27 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-refresh needs-unit-  |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by ocean90):

 * keywords:  has-patch needs-unit-tests => has-patch needs-refresh needs-
     unit-tests


Comment:

 [attachment:22249.5.diff]:

 * Needs a refresh after recent changes
 * "The sixth argument was added. " should be "Introduced the `$attributes`
 parameter."
 * In `get_script_src()` spaces should be added when using variables as
 array keys, `$this->registered[$handle];` => `$this->registered[ $handle
 ];`
 * IMO `get_script_attributes()` shouldn't return the `$src` value. I'd
 call it `get_(script)_additonal_attributes()`. That would solve all the
 special cases which makes the code a bit too complex right now.
 * This shouldn't go in without support for styles. Note that `WP_Styles`
 has already `_css_href( $src, $ver, $handle )`.

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


More information about the wp-trac mailing list