Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#20561 closed enhancement (fixed)

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

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

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 13 months ago.
20561-2.patch (936 bytes) - added by azaozz 13 months ago.

Download all attachments as: .zip

Change History (8)

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

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

  • 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
Last edited 13 months ago by scribu (previous) (diff)

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?

  • 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

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