[wp-trac] [WordPress Trac] #19592: Automate script and style compression and bumps

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 26 06:33:30 UTC 2012


#19592: Automate script and style compression and bumps
-------------------------+------------------
 Reporter:  nacin        |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  3.4
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------

Comment (by azaozz):

 Replying to [comment:27 mbijon]:
 > What is the preferred JS coding standard...

 Frankly I prefer all vars to be at the top and in one declaration, that
 was the usual way in the early JS days I think (similar to camel case var
 names) :)

 The coding standard for JS is roughly the same as for PHP with some
 language specific exceptions.

 > Specific to those "use only one {{{--> var <--}}}" warnings...

 These actually should be:

 {{{
 var useWindow = false, coordinates = {}, x = 0, y = 0;
 }}}

 Note the spaces around the `=` and the shorthand for defining new object.

 > The standard I've seen more often is from JSLint/Crockford and also
 happens to match WP's trend toward more-readable code...

 Don't think repeating `var` on each line makes it more readable but that's
 just a personal opinion. It makes it to look more like a PHP class
 declaration, not JS. In WP almost all JS vars are defined on the same line
 with one `var` and that's from before we started using YUI.

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


More information about the wp-trac mailing list