From 1baac22e9d6b55cb62e440a2a938a288fce597ed Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Sat, 6 Oct 2012 00:43:36 +0000 Subject: [PATCH] Improve the lazy instantiation of the 'wp' JavaScript variable. props evansolomon, fixes #22113. git-svn-id: http://core.svn.wordpress.org/trunk@22126 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/customize-base.js | 3 +-- wp-includes/js/customize-loader.js | 3 +-- wp-includes/js/mce-view.js | 3 +-- wp-includes/js/media-models.js | 3 +-- wp-includes/js/plupload/wp-plupload.js | 3 +-- wp-includes/js/shortcode.js | 3 +-- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/wp-includes/js/customize-base.js b/wp-includes/js/customize-base.js index d25ec31f60..81d37716e6 100644 --- a/wp-includes/js/customize-base.js +++ b/wp-includes/js/customize-base.js @@ -1,5 +1,4 @@ -if ( typeof wp === 'undefined' ) - var wp = {}; +window.wp = window.wp || {}; (function( exports, $ ){ var api, extend, ctor, inherits, diff --git a/wp-includes/js/customize-loader.js b/wp-includes/js/customize-loader.js index 01cec6aca3..bd34484465 100644 --- a/wp-includes/js/customize-loader.js +++ b/wp-includes/js/customize-loader.js @@ -1,5 +1,4 @@ -if ( typeof wp === 'undefined' ) - var wp = {}; +window.wp = window.wp || {}; (function( exports, $ ){ var api = wp.customize, diff --git a/wp-includes/js/mce-view.js b/wp-includes/js/mce-view.js index c1b08a574b..e9c1fcf674 100644 --- a/wp-includes/js/mce-view.js +++ b/wp-includes/js/mce-view.js @@ -1,6 +1,5 @@ // Ensure the global `wp` object exists. -if ( typeof wp === 'undefined' ) - var wp = {}; +window.wp = window.wp || {}; // HTML utility functions // ---------------------- diff --git a/wp-includes/js/media-models.js b/wp-includes/js/media-models.js index aff6596e55..b10a5a2eb9 100644 --- a/wp-includes/js/media-models.js +++ b/wp-includes/js/media-models.js @@ -1,5 +1,4 @@ -if ( typeof wp === 'undefined' ) - var wp = {}; +window.wp = window.wp || {}; (function($){ var Attachment, Attachments, Query, compare; diff --git a/wp-includes/js/plupload/wp-plupload.js b/wp-includes/js/plupload/wp-plupload.js index 9149e24ada..9ab2e72371 100644 --- a/wp-includes/js/plupload/wp-plupload.js +++ b/wp-includes/js/plupload/wp-plupload.js @@ -1,5 +1,4 @@ -if ( typeof wp === 'undefined' ) - var wp = {}; +window.wp = window.wp || {}; (function( exports, $ ) { var Uploader; diff --git a/wp-includes/js/shortcode.js b/wp-includes/js/shortcode.js index 427efe0ebf..d503e08172 100644 --- a/wp-includes/js/shortcode.js +++ b/wp-includes/js/shortcode.js @@ -1,8 +1,7 @@ // Utility functions for parsing and handling shortcodes in Javascript. // Ensure the global `wp` object exists. -if ( typeof wp === 'undefined' ) - var wp = {}; +window.wp = window.wp || {}; (function(){ wp.shortcode = {