Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#22113 closed enhancement (fixed)

Checking for the 'wp' JavaScript variable could be simpler

Reported by: evansolomon Owned by: koopersmith
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: General Keywords: has-patch
Focuses: Cc:


In a few places we do this:

if ( typeof wp === 'undefined' )
    var wp = {};

That could be simplified to a one liner that's easier to read:

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

Attachments (1)

22113.patch (2.3 KB) - added by evansolomon 3 years ago.

Download all attachments as: .zip

Change History (4)

#1 @evansolomon
3 years ago

  • Keywords has-patch added

#2 @koopersmith
3 years ago

  • Milestone changed from Awaiting Review to 3.5
  • Version set to trunk

Nice patch.

3 years ago

#3 @koopersmith
3 years ago

  • Owner set to koopersmith
  • Resolution set to fixed
  • Status changed from new to closed

In [22126]:

Improve the lazy instantiation of the 'wp' JavaScript variable. props evansolomon, fixes #22113.

Note: See TracTickets for help on using tickets.