WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#20561 closed enhancement (fixed)

Accelerating some js calls, and changing the check-point for another.

Reported by: georgestephanis Owned by: azaozz
Milestone: 3.4 Priority: normal
Severity: minor Version:
Component: General Keywords: needs-patch
Focuses: Cc:

Description

First change in the patch falls back from using jQuery to pure JS -- should be much quicker as it'll be loading frequently.

Second change lets us base it off of how the back-end calculates mobile, rather than just 'mobile' in the UA string. Should converge them to one test point, rather than dispersed ones.

Attachments (2)

20561.diff (748 bytes) - added by georgestephanis 2 years ago.
20561-2.patch (936 bytes) - added by azaozz 2 years ago.

Download all attachments as: .zip

Change History (8)

georgestephanis2 years ago

comment:1 scribu2 years ago

Instead of dropping down to raw JS, why not cache it in a variable at the beginning? It's not like it will change.

comment:2 georgestephanis2 years ago

I didn't want to add another global variable to check.

comment:3 scribu2 years ago

  • Keywords needs-patch added; has-patch removed

1) it doesn't need to be global; just move it up one level in scope
2) it should be faster than executing a .match() every time

Version 0, edited 2 years ago by scribu (next)

comment:4 azaozz2 years ago

jQuery seems to cache the selectors anyways, not sure if this would make any difference. On the other hand it's a good practice to set things like this to a variable instead of running it every time.

BTW isn't this a duplicate of #20557?

azaozz2 years ago

comment:5 azaozz2 years ago

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

In [20677]:

Move the check for body.mobile in postbox.js to a variable as it's used in more than one place, props georgestephanis, scribu, fixes #20561

comment:6 azaozz2 years ago

  • Milestone changed from Awaiting Review to 3.4
Note: See TracTickets for help on using tickets.