WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 9 months ago

#40333 new defect (bug)

TwentySeventeen: customize-controls.js passes unused jQuery argument to an IIFE that accepts no arguments

Reported by: Christian1012 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: Bundled Theme Keywords: has-patch
Focuses: javascript Cc:

Description

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.

Attachments (1)

40333.0.diff (376 bytes) - added by Christian1012 9 months ago.

Download all attachments as: .zip

Change History (2)

#1 @Christian1012
9 months ago

  • Keywords has-patch added

40333.0.diff added.

Note: See TracTickets for help on using tickets.