[wp-trac] [WordPress Trac] #38809: Better wp namespace in password-strength-meter.js

WordPress Trac noreply at wordpress.org
Tue Nov 15 23:27:38 UTC 2016


#38809: Better wp namespace in password-strength-meter.js
----------------------------+----------------------------
 Reporter:  afercia         |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Future Release
Component:  Administration  |    Version:
 Severity:  normal          |   Keywords:  needs-patch
  Focuses:  javascript      |
----------------------------+----------------------------
 Currently, `password-strength-meter.js` uses this pattern to pass the wp
 object as argument:

 {{{
 window.wp = window.wp || {};

 var passwordStrength;
 (function($){
         wp.passwordStrength = {
 ...

 })(jQuery);
 }}}

 so `wp` inside the IIFE is, technically, undefined, even if WordPress
 considers `wp` a global object. Also the first line is pointless if then
 `window.wp` is not passed as argument.

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


More information about the wp-trac mailing list