[wp-trac] [WordPress Trac] #38809: Better wp namespace in password-strength-meter.js
WordPress Trac
noreply at wordpress.org
Tue Nov 16 15:18:01 UTC 2021
#38809: Better wp namespace in password-strength-meter.js
-------------------------------------------------+-------------------------
Reporter: afercia | Owner:
| davidbaumwald
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: Future
| Release
Component: Administration | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs- | Focuses: javascript
testing-info close |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):
* keywords: has-patch needs-testing needs-testing-info 2nd-opinion => has-
patch needs-testing needs-testing-info close
* milestone: 5.9 => Future Release
Comment:
`window.wp` is a global,`wp` is available within the IIFE (as IIFEs can
access global variables). [https://jsfiddle.net/hellofromtonya/7sLrgf9e/1/
See it in action here]. I'm not seeing a bug with this implementation,
though readability is not the best IMO.
There are multiple types of implementations in the core scripts including
the design pattern in the password strength script, injecting `window`
into the IIFE as another param (along with `jQuery`), and setting the
global within the IIFE.
It would be nice to have a consistent design approach across all of these
scripts, though outside the scope of this specific ticket. Maybe a new
ticket can be opened to explore that type of enhancement.
As the IIFE works with global variables, marking this ticket as a `close`
candidate and moving to `Future Release`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38809#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list