Opened 8 years ago
Closed 5 years ago
#40333 closed defect (bug) (fixed)
TwentySeventeen: customize-controls.js passes unused jQuery argument to an IIFE that accepts no arguments
Reported by: | Christian1012 | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.3 | 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 (2)
Change History (9)
This ticket was mentioned in Slack in #core-themes by hareesh-pillai. View the logs.
5 years ago
#3
@
5 years ago
- Milestone changed from Awaiting Review to 5.3
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
#4
@
5 years ago
Hi @Christian1012, welcome to WordPress Trac!
Thanks for the ticket and the patch! Sorry it took so long for someone to get back to you.
Looks like this was done for consistency with other files (where $
is used), or maybe as a copy/paste from those files. I have no objections to changing it though.
The same should be done for Twenty Nineteen's customize-controls.js
as well.
40333.0.diff added.