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.
❌ 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' ) );