[wp-trac] [WordPress Trac] #28404: wp_script_is() returns false for scripts enqueued via dependencies.

WordPress Trac noreply at wordpress.org
Fri May 30 10:52:59 UTC 2014


#28404: wp_script_is() returns false for scripts enqueued via dependencies.
---------------------------+-----------------------------
 Reporter:  mikejolley     |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Script Loader  |    Version:  3.9.1
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 Register/enqueue a script with dependencies, e.g.

 {{{
 wp_enqueue_script( 'wc-cart', $src, array( 'jquery', 'wc-country-select'
 ), $version, true );
 }}}

 With the above example I've enqueued wc-cart and, via a dependency, wc-
 country-select. The problem is:

 {{{
 wp_script_is( 'wc-country-select', 'enqueued' );
 }}}

 will always return false. This is due to the query method in the
 WP_Dependencies class not checking the dependencies of each enqueued
 handle.

 IMO this should return true. The script is enqueued via dependency -
 without a way to check this I cannot conditionally localize my scripts
 without checking all dependencies.

 Fix will be attached.

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


More information about the wp-trac mailing list