Automattic / Automattic/o2

Depreciated jQuery reported by jQuery Migrate Plugin

Open
#216 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
338
Forks
56
Avg merge
24m
Merged PRs (30d)
16

Description

## From jQuery Migrate Plugin

https://wordpress.org/plugins/enable-jquery-migrate-helper/

`jQuery.fn.unload() is deprecated | Plugin: o2 | https://****/wp-content/plugins/o2/modules/offline/js/offline.js`

` \'ready\' event is deprecated | Plugin: o2 | https://****/wp-content/plugins/o2/js/editor/editor.js`

### False Positives

`wp-content/plugins/o2/modules/notifications/js/app/notifications.js` leverages the event `ready.o2`, which jQuery Migrate Plugin picks up as a false positive.

### Solution: ready event is depreciated

I'm following this article as a guide: https://api.jquery.com/ready/

`wp-content/plugins/o2/js/editor/editor.js:84`

replace

`
$doc.on( 'ready', function() {
`

with

`
$(function() {
`

### Solution: unload is depreciated

I'm following this guide:
https://stackoverflow.com/questions/46443032/what-is-a-foolproof-alternative-to-window-unload/46443788

`/wp-content/plugins/o2/modules/offline/js/offline.js:31`

Change

`
jQuery( window ).unload( function() {
o2.Offline.onWindowUnloading();
} );
`
To

`
jQuery( window ).on( 'beforeunload' , function() {
o2.Offline.onWindowUnloading();
} );
`

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect wp-content/plugins/o2/js/editor/editor.js:84 and wp-content/plugins/o2/modules/offline/js/offline.js:31, then review notifications.js to distinguish the reported false positive. Verify the two deprecated jQuery usages are addressed and that the jQuery Migrate warnings no longer appear for these files.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.