[wp-trac] [WordPress Trac] #38806: Better wp namespace in customize-base.js
WordPress Trac
noreply at wordpress.org
Thu Nov 17 22:54:00 UTC 2016
#38806: Better wp namespace in customize-base.js
--------------------------+------------------------------
Reporter: afercia | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: javascript
--------------------------+------------------------------
Comment (by peterwilsoncc):
I'd like to see a consistent pattern across all files too, if nothing else
to avoid unnecessary scope traversal.
This is my pattern of choice as it protects against accidental defining of
`undefined`.
{{{#!js
( function( window, undefined ) {
window.wp = window.wp || {};
var document = window.document;
var $ = window.jQuery;
var wp = window.wp;
})( window );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38806#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list