[wp-trac] [WordPress Trac] #35956: Script's dependencies are always moved to header

WordPress Trac noreply at wordpress.org
Sun Mar 6 19:49:57 UTC 2016


#35956: Script's dependencies are always moved to header
---------------------------+----------------------
 Reporter:  stephenharris  |       Owner:  ocean90
     Type:  defect (bug)   |      Status:  closed
 Priority:  normal         |   Milestone:  4.5
Component:  Script Loader  |     Version:  trunk
 Severity:  normal         |  Resolution:  fixed
 Keywords:  has-patch      |     Focuses:
---------------------------+----------------------
Changes (by ocean90):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"36871"]:
 {{{
 #!CommitTicketReference repository="" revision="36871"
 Dependencies: Improve group processing of script dependencies.

 This is a follow-up to [36604].

 When processing dependencies `$this->group` will be the minimum of the
 script's registered group and all preceding siblings. This is wrong
 because only a scripts ancestors in the dependency chain should affect
 where it is loaded. Effectively `$this->group` introduced a form of global
 state which potentially corrupted the group of dependencies. Sorting
 covers up this problem.
 The issue in #35873 was that script were not moving their dependencies to
 a lower group when necessary.

 The fix:
 * In `WP_Dependencies::all_deps()` pass the new `$group` value to
 `WP_Dependencies::all_deps()`. Previously the wrong value was passed
 because the parent script could have moved with `WP_Scripts::set_group()`.
 * In `WP_Scripts::all_deps()` pass the `$group` parameter to
 `WP_Dependencies::all_deps()` so it doesn't always use `false` for
 `$group`. Same for `WP_Styles::all_deps()`.

 Props stephenharris, gitlost.
 Fixes #35956.
 }}}

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


More information about the wp-trac mailing list