[wp-trac] [WordPress Trac] #55491: Replace `unload` event handlers from core (was: Replace unload from heartbeat js)

WordPress Trac noreply at wordpress.org
Thu Aug 10 19:10:59 UTC 2023


#55491: Replace `unload` event handlers from core
----------------------------+--------------------------------------
 Reporter:  shawfactor      |       Owner:  westonruter
     Type:  enhancement     |      Status:  accepted
 Priority:  normal          |   Milestone:  6.4
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:  javascript, performance
----------------------------+--------------------------------------
Description changed by adamsilverstein:

Old description:

> Right now the heartbeat javascript library uses an unload handler, this
> means that where ever it is used the page is not elgible for the bfcache
> in many browsers.
>
> https://web.dev/bfcache/
>

> Wordpress could get a significant performance improvement if this
> listener was replaced by using the page visibility api or a combination
> of pagehide handlers. Which i assume are possible in jquery

New description:

 Right now the heartbeat javascript library uses an unload handler, this
 means that where ever it is used the page is not elgible for the bfcache
 in many browsers.

 https://web.dev/bfcache/


 Wordpress could get a significant performance improvement if this listener
 was replaced by using the page visibility api or a combination of pagehide
 handlers. Which i assume are possible in jquery

 ----
 Added Aug 10. by Adam Silverstein:
 Chrome has deprecated the `unload` event
 (https://developer.chrome.com/blog/deprecating-unload/) so I expanded this
 ticket to include replacing/updating all uses of the `unload` event in
 core.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55491#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list