Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.26 KB

no-unload-shorthand.md

File metadata and controls

41 lines (31 loc) · 1.26 KB

no-unload-shorthand

Disallows the .unload method. Prefer .on or .trigger.

📋 This rule is enabled in plugin:no-jquery/deprecated-1.8.

🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

Rule details

❌ Examples of incorrect code:

$( 'div' ).unload( handler );
$div.unload();
$( 'div' ).first().unload();
$( 'div' ).append( $( 'input' ).unload() );

✔️ Examples of correct code:

unload();
[].unload();
div.unload();
div.unload;
$.unload();

🔧 Examples of code fixed by this rule:

$( 'div' ).unload( handler );               /* → */ $( 'div' ).on( 'unload', handler );
$div.unload();                              /* → */ $div.trigger( 'unload' );
$( 'div' ).first().unload();                /* → */ $( 'div' ).first().trigger( 'unload' );
$( 'div' ).append( $( 'input' ).unload() ); /* → */ $( 'div' ).append( $( 'input' ).trigger( 'unload' ) );

Resources