[wp-trac] [WordPress Trac] #40333: TwentySeventeen: customize-controls.js passes unused jQuery argument to an IIFE that accepts no arguments

WordPress Trac noreply at wordpress.org
Sat Apr 1 18:35:12 UTC 2017


#40333: TwentySeventeen: customize-controls.js passes unused jQuery argument to an
IIFE that accepts no arguments
---------------------------+-----------------------------
 Reporter:  Christian1012  |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Bundled Theme  |    Version:  4.7
 Severity:  normal         |   Keywords:
  Focuses:  javascript     |
---------------------------+-----------------------------
 The IIFE (Immediately Invoked Function Expression) in customize-
 controls.js looks like this:

 {{{
 (function() {
     // Do stuff
 })( jQuery );
 }}}

 In the context of jQuery, this style is used to alias `jQuery` as `$`
 within the function expression.

 Example:
 {{{
 (function( $ ) {
     console.log( $( 'body' ) );
 })( jQuery );
 }}}

 `jQuery` is not used in the function block, nor does the function
 expression accept an argument, so my recommendation would be to remove it.
 If there is a reason to pass jQuery as an argument, then the function
 expression should at least accept it as an argument.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40333>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list