[wp-trac] [WordPress Trac] #21134: Registering and enqueueing on the same action can cause enqueueing to happen before registering

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 2 22:48:02 UTC 2012


#21134: Registering and enqueueing on the same action can cause enqueueing to
happen before registering
--------------------------+------------------------------
 Reporter:  nbachiyski    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.4
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by azaozz):

 Related: #20971 and [21134].

 An option is to defer checking for dependencies in WP_Scripts. This will
 also solve the problem with preliminary init but will make WP_Scripts a
 bit more complicated.

 The idea is to skip checking for dependencies on "enqueue". So calling
 WP_Dependencies::enqueue() would not check if
 `isset($this->registered[$handle[0]])`. That would allow us to add the
 default scripts later (at init 20?) and to check whether all enqueued
 scripts have their dependencies available and enqueue these dependencies
 after that.

 It would also be cleaner if we separate script-loader.php into two files:
 one that only lists the default scripts and another that has all the
 functions.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21134#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list