Make WordPress Core

Opened 5 weeks ago

Last modified 4 days ago

#44371 assigned defect (bug)

Make sure all JS globals are explicitly assigned to the window.

Reported by: omarreiss Owned by: omarreiss
Milestone: 5.0 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch commit
Focuses: javascript Cc:


Currently there are a lot of variables in the JavaScript that are being defined in the global scope without being explicitly assigned to the window. When we start using Webpack to build all the JavaScript, the code will get encapsulated in an anonymous function and those implicit globals could get assigned to a different scope. To make sure that doesn't happen, I've created a patch to make sure all globals are explicitly assigned to the window.

Attachments (1)

explicit-globals.patch (21.7 KB) - added by omarreiss 5 weeks ago.

Download all attachments as: .zip

Change History (6)

#1 @subrataemfluence
5 weeks ago

  • Keywords has-patch needs-testing added

#2 @netweb
5 weeks ago

  • Milestone changed from Awaiting Review to 5.0

This ticket was mentioned in Slack in #core-js by adamsilverstein. View the logs.

4 weeks ago

This ticket was mentioned in Slack in #core-js by aduth. View the logs.

3 weeks ago

#5 @pento
4 days ago

  • Keywords commit added; needs-testing removed
  • Owner set to omarreiss
  • Status changed from new to assigned

Let's get this in.

All of these globals appear to be intended to be globally scoped: they're all declared outside the functions where they're used later in the files.

Note: See TracTickets for help on using tickets.