General: Explicitly assigns all JS globals to the window.

Many variables in the JavaScript were defined in the global scope without being explicitly assigned to the window. When built with Webpack, the code gets encapsulated in anonymous functions and those implicit globals get assigned to the wrong scope. This patch prevents that from happening.

Fixes #44371. See #43731.

Built from https://develop.svn.wordpress.org/trunk@43577


git-svn-id: http://core.svn.wordpress.org/trunk@43406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
omarreiss
2018-08-19 13:33:24 +00:00
parent 879f43f278
commit bdbaccce37
45 changed files with 134 additions and 151 deletions

View File

@@ -4,8 +4,8 @@
* @output wp-admin/js/plugin-install.js
*/
/* global plugininstallL10n, tb_click, tb_remove */
var tb_position;
/* global plugininstallL10n, tb_click, tb_remove, tb_position */
jQuery( document ).ready( function( $ ) {
var tbWindow,
@@ -18,7 +18,7 @@ jQuery( document ).ready( function( $ ) {
$wrap = $ ( '.wrap' ),
$body = $( document.body );
tb_position = function() {
window.tb_position = function() {
var width = $( window ).width(),
H = $( window ).height() - ( ( 792 < width ) ? 60 : 20 ),
W = ( 792 < width ) ? 772 : width - 20;