[wp-trac] [WordPress Trac] #38809: Better wp namespace in password-strength-meter.js
WordPress Trac
noreply at wordpress.org
Thu Nov 11 22:33:00 UTC 2021
#38809: Better wp namespace in password-strength-meter.js
-------------------------------------------------+-------------------------
Reporter: afercia | Owner:
| davidbaumwald
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 5.9
Component: Administration | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs- | Focuses: javascript
testing-info 2nd-opinion |
-------------------------------------------------+-------------------------
Changes (by davidbaumwald):
* keywords: has-patch needs-testing needs-testing-info => has-patch needs-
testing needs-testing-info 2nd-opinion
Comment:
After looking through the codebase a bit at similar admin scripts, the
`window.wp = window.wp || {};` pattern is common. However, the `wp`
variable is aliased inside the IIFE.
Rather than removing the the `window.wp = window.wp || {};` line, I think
it's probably better to just pass `wp` to the IIFE. Updated patch
incoming.
Adding `2nd-opinion` here to see if this is the right approach, or should
all other instances of this pattern be revisited.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38809#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list