Skip to content

Commit bb93b6b

Browse files
committed
Queue all default scripts for the head when a custom script lists them as dependencies, fixes WordPress#9620
git-svn-id: https://develop.svn.wordpress.org/trunk@11058 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 563583c commit bb93b6b

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

wp-includes/class.wp-dependencies.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,16 @@ function all_deps( $handles, $recursion = false, $group = false ) {
8383
foreach ( $handles as $handle ) {
8484
$handle_parts = explode('?', $handle);
8585
$handle = $handle_parts[0];
86+
$queued = in_array($handle, $this->to_do, true);
8687

8788
if ( in_array($handle, $this->done, true) ) // Already done
8889
continue;
8990

90-
$this->set_group( $handle, $recursion, $group );
91-
92-
if ( in_array($handle, $this->to_do, true) ) // Already grobbed it and its deps
91+
$moved = $this->set_group( $handle, $recursion, $group );
92+
93+
if ( $queued && !$moved ) // already queued and in the right group
9394
continue;
9495

95-
if ( isset($handle_parts[1]) )
96-
$this->args[$handle] = $handle_parts[1];
97-
9896
$keep_going = true;
9997
if ( !isset($this->registered[$handle]) )
10098
$keep_going = false; // Script doesn't exist
@@ -110,6 +108,12 @@ function all_deps( $handles, $recursion = false, $group = false ) {
110108
continue; // We're at the top level. Move on to the next one.
111109
}
112110

111+
if ( $queued ) // Already grobbed it and its deps
112+
continue;
113+
114+
if ( isset($handle_parts[1]) )
115+
$this->args[$handle] = $handle_parts[1];
116+
113117
$this->to_do[] = $handle;
114118
}
115119

wp-includes/class.wp-scripts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function set_group( $handle, $recursion, $group = false ) {
146146
if ( false !== $group && $grp > $group )
147147
$grp = $group;
148148

149-
parent::set_group( $handle, $recursion, $grp );
149+
return parent::set_group( $handle, $recursion, $grp );
150150
}
151151

152152
function all_deps( $handles, $recursion = false, $group = false ) {

0 commit comments

Comments
 (0)