[wp-trac] [WordPress Trac] #35873: wp_register_script grandchild level dependency not rendered

WordPress Trac noreply at wordpress.org
Fri Feb 19 16:37:22 UTC 2016


#35873: wp_register_script grandchild level dependency not rendered
----------------------------------+-----------------------------
 Reporter:  Dima Stefantsov       |      Owner:
     Type:  defect (bug)          |     Status:  new
 Priority:  normal                |  Milestone:  Awaiting Review
Component:  Script Loader         |    Version:  trunk
 Severity:  normal                |   Keywords:
  Focuses:  javascript, template  |
----------------------------------+-----------------------------
 [http://wordpress.stackexchange.com/questions/218230/wp-enqueue-script-
 with-dependencies-doesnt-work]

 I'm having this code:

 {{{#!php
 wp_register_script('parent','parent.js', array('child'), '1', true);
 wp_register_script('child', 'child.js', array('grandchild'), '1', true);
 wp_register_script('grandchild', 'grandchild.js', array(), '1', true);
 wp_enqueue_script('parent');
 }}}

 and it works fine, rendering grandchild.js, then child.js, then parent.js
 in footer.

 Every combination of just parent and child works fine, regardless of TRUE
 or FALSE 'render in footer'. But when I register 'child' to be rendered in
 '''head''' instead:

 {{{#!php
 wp_register_script('parent','parent.js', array('child'), '1', true);
 wp_register_script('child', 'child.js', array('grandchild'), '1', FALSE);
 wp_register_script('grandchild', 'grandchild.js', array(), '1', true);
 wp_enqueue_script('parent');
 }}}

 Then child.js gets rendered in head, parent.js gets rendered in footer,
 '''and grandchild.js is not rendered at all !''' Even though there is
 obviously a dependency for it.

 Looks like a bug to me.

 On a first glance, it looked like a
 https://core.trac.wordpress.org/ticket/35643 , but I have just downloaded
 night wp build https://wordpress.org/nightly-builds/wordpress-latest.zip
 and problem still persists.

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


More information about the wp-trac mailing list