[wp-trac] [WordPress Trac] #19910: Appearance Improvements: Theme Customization Frame

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 27 00:39:31 UTC 2012


#19910: Appearance Improvements: Theme Customization Frame
----------------------------+--------------------------
 Reporter:  koopersmith     |       Owner:  koopersmith
     Type:  task (blessed)  |      Status:  accepted
 Priority:  normal          |   Milestone:  3.4
Component:  Themes          |     Version:  3.3.1
 Severity:  normal          |  Resolution:
 Keywords:                  |
----------------------------+--------------------------

Comment (by azaozz):

 Replying to [comment:11 nacin]:
 > Yes it can. And in fact, it does, due to how the preview iframe works.
 There is no actual harm to placing JS in wp-includes over wp-admin. The
 rule of thumb I have used is that if it is a library of sorts, or
 decoupled nicely from the admin, or something that could be employed on
 the frontend (like pointers), it should go into wp-includes. The only
 things that should go into wp-admin is code intrinsically tied to the
 admin interface.

 Yes, in general there's no harm. I was talking about the php and css code
 too, not only the JS. Imho it doesn't make sense all these files to be in
 wp-includes as they all are only used when the user is in the admin and
 are useless on the front-end.

 > There is not another framework here, nor is there a whole lot of
 complexity.

 Not exactly. The JS is build as a framework on top of jQuery with the
 actual functions that "do the work" being several levels "deep". Don't see
 a point in having JS classes for a few jQuery based single-use lines of
 JS.

 > For the JS files, no. They are loaded in different places. customize-
 loader.js handles the ability to load the customizer. customize-controls
 gets loaded in the frame that handles the controls. customize-preview gets
 loaded in the preview iframe. customize-base is a shared base class of
 both customize-preview and customize-controls. As they are nicely
 decoupled, they should remain separate.

 Agreed. Generally loading one larger JS file is better than segmenting it
 into several small files as after the first load the browsers keep all of
 it in memory cache. The same is true for the css. However when using JS
 concatenation the file that is loaded would probably be already different
 so the browsers would have to load it again.

 > For the PHP files, no. Individual classes belong in separate files. The
 fourth file, customize-controls.php, is a special file that is included to
 handle the controls after WP is hijacked.

 I'm not sure it's a good idea to use OOP structures to output HTML in a
 non-OOP app. There is only one screen so there is only one "instance" of
 the HTML. What's the point of building specific OOP structure for only
 this part of the code that is used only once? But that discussion is not
 for here.

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


More information about the wp-trac mailing list