[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:53:24 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 boonebgorges):

 Cool, this is shaping up nicely.

 The method name `get_concatenated_script_attributes()` threw me for a
 loop, because 'concatenated' has a different and more frequently used
 meaning in the context of scripts/styles. I'd suggest something like
 `get_script_attribute_html()`.

 Did we actively decide not to give the same treatment to
 `wp_enqueue_style()`?

 Why are we passing around `$handle` and `$src` in
 `get_concatenated_script_attributes()`, etc, but getting `$args` and
 `$attributes` from object properties?

 Can we not do the weird ternary formatting in `get_script_attributes()`?
 If it's so confusing, just make it an `if/else` :)

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

 You mean `'script_loader_attributes'`? I guess I'd keep it - seems like
 there might be legit cases where programatically modification is
 appropriate - but I'd move it to `get_script_attributes()`.

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


More information about the wp-trac mailing list