WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 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:

Description

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 2 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 @evansolomon2 years ago

  • Keywords has-patch added

comment:2 @koopersmith2 years ago

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

Nice patch.

@evansolomon2 years ago

comment:3 @koopersmith2 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.