@frogeducation/eslint-plugin-jquery-compat
v3.5.9
Published
Linting rules for checking jQuery version compatibility
Downloads
280
Readme
eslint-plugin-jquery-compat
$('').data('helloworld') // --> "no"
Examples of **correct** code for this rule:
```js
$('<div data-hello-world="yes" />')
Further reading:
- v3.0
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
v1.9
@frogeducation/jquery-compat/attr-select
Cause: Prior to jQuery 1.9, $().attr("checked")
etc. would sometimes use the checked|selected property instead of the attribute when interacting with non-XML elements, despite the fact that browsers and the HTML specifications allow the properties (current state) to differ from the attributes (initial/default state). This was a holdover from earlier versions of jQuery that did not offer $().prop
.
Solution: Boolean properties should generally not be passed to $().attr
at all; replace with $().prop
unless you truly intend to update the underlying HTML attribute.
Examples of incorrect code for this rule:
if ($foo.attr("selected")) { /* ... */ }
if ($foo.attr("checked")) { /* ... */ }
if ($foo.attr("disabled")) { /* ... */ }
Examples of correct code for this rule:
if ($foo.prop("selected")) { /* ... */ }
if ($foo.prop("checked")) { /* ... */ }
if ($foo.prop("disabled")) { /* ... */ }
Further reading:
- v1.9
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/deferred-use-state
deferred.isRejected()
and deferred.isResolved()
were removed in jQuery 1.8;
use deferred.state() === 'rejected'
and deferred.state() === 'resolved'
instead (deferred.state()
may also return 'pending'
).
Examples of incorrect code for this rule:
var myDeferred = $.Deferred()
if (myDeferred.isRejected()) {
/* ...snip... */
} else (myDeferred.isResolved()) {
/* ...snip... */
}
Examples of correct code for this rule:
var myDeferred = $.Deferred()
if (myDeferred.state() === 'rejected') {
/* ...snip... */
} else (myDeferred.state() === 'resolved') {
/* ...snip... */
}
Further reading:
- v1.9
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/html-string-must-start-with-tag
Cause: In jQuery 1.9, HTML strings passed to $()
must start with a tag; in other words the first character of the string must be a <
character. There cannot be any preceding characters, including whitespace. This is done to reduce the chances of inadvertent execution of scripts that might be present in HTML that is obtained from the URL, AJAX, or other sources. Use of simple literal HTML strings like $("<div />")
or $("<p>hello</p>")
are unaffected since they should not have leading spaces or text.
Solution: Use the $.parseHTML()
method to parse arbitrary HTML, especially HTML from external sources. To obtain a jQuery object that has the parsed HTML without running scripts, use $($.parseHTML("string"))
. To run scripts in the HTML as well, use $($.parseHTML("string", document, true))
instead. We do not recommend running $.trim()
on the string to circumvent this check.
Examples of incorrect code for this rule:
$("hello <strong>world</strong>")
Examples of correct code for this rule:
$($.parseHTML("hello <strong>world</strong>"))
$("<span>hello <strong>world</strong></span>")
Further reading:
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/jmvc/no-null-model-calls
Cause: jQuery.param()
(used to build query string parameters in api calls from models) no longer encodes null
or undefined
as strings; in stead it encodes them as empty strings.
Solution: Rewrite any code that passes null
or undefined
to model calls to pass these as strings, or omit them, as appropriate.
Examples of incorrect code for this rule:
Foo.Models.Bar.baz({ foo: null, bar: undefined, baz: 42 })
Examples of correct code for this rule:
Foo.Models.Bar.baz({ foo: "null", bar: "undefined", baz: 42 })
Foo.Models.Bar.baz({ baz: 42 })
Further reading:
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-andself
The .andSelf() method has been renamed to .addBack() as of jQuery 1.9 to better reflect its purpose of adding back the previous set of results.
Replace any use of .andSelf() with .addBack().
Examples of incorrect code for this rule:
$('.foo').find('.bar').andSelf()
Examples of correct code for this rule:
$('.foo').find('.bar').addBack()
Further reading:
- v1.9
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-attr-value
Prior to jQuery 1.9, $().attr("value")
retrieved the value property instead of
the value attribute (which generally reflects the value that was read from HTML
markup). $().attr( "value", val )
set the value property instead of the value
attribute. This caused inconsistent behavior with selectors referencing the
value attribute.
Use $().val() (for form controls) or $().prop("value") (for other elements) to get the current value, and try to explicitly limit the use of [value=…] in selectors to input and/or option elements wherever possible. Use $().val( val ) (for form controls) or $().prop( "value", val ) (for other elements) to set the current value.
Examples of incorrect code for this rule:
var value = $('input.foo').attr('value')
$('input.foo').attr('value', 'newValue')
Examples of correct code for this rule:
var value = $('input.foo').val()
$('input.foo').val('newValue')
var value2 = $('div.bar').prop('value')
$('div.bar').prop('value', 'newValue')
- v1.9
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-attrfn
Cause: Prior to jQuery 1.8, the undocumented jQuery.attrFn
object provided a list of properties supported by the $(html, props)
method. It is no longer required as of jQuery 1.8, but some developers "discovered" it by reading the source and began to use it. Their code still expects jQuery.attrFn
to be present, attempts to assign values to it, and will throw errors if it is not present.
Solution: Ensure that you are using the latest version of jQuery UI (1.8.21 or later) and jQuery Mobile (1.2.1 or later); they no longer use jQuery.attrFn
. Examine any third-party plugins for the string attrFn
and report its use to the plugin authors (not to jQuery team).
Examples of incorrect code for this rule:
$.attrFn.foo = "bar"
Examples of correct code for this rule:
(none provided)
Further reading:
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-box-model
These two deprecated properties are false when the page is using Quirks mode, and true when the page is in standards mode. Quirks mode was never supported in jQuery so these properties were removed.
Do not use jQuery in Quirks mode, it has never been supported.
Examples of incorrect code for this rule:
if ($.boxModel) { /* ...snip... */ }
if ($.support.boxModel) { /* ...snip... */ }
if (jQuery.boxModel) { /* ...snip... */ }
if (jQuery.support.boxModel) { /* ...snip... */ }
Examples of correct code for this rule:
// use feature detection in stead
Further reading:
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-browser
jQuery.browser was deprecated in version 1.3, and finally removed in 1.9. Browser sniffing is notoriously unreliable as means of detecting whether to implement particular features.
Where possible, use feature detection to make code decisions rather than trying to detect a specific browser. The Modernizr library provides a wide variety of feature detections. As a last resort, you can directly look at the navigator.userAgent string to detect specific strings returned by the browser.
Examples of incorrect code for this rule:
if (!$.browser.msie) {
console.log("supported!")
}
Examples of correct code for this rule:
if (window.someFeature) {
console.log("supported!")
}
Further reading:
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-buildFragment
Cause: jQuery.buildFragment()
and jQuery.clean()
are undocumented internal methods. The signature of jQuery.buildFragment()
was changed in jQuery 1.8 and 1.9, and jQuery.clean()
was removed in 1.9. However, we are aware of some plugins or other code that might be using them.
Solution: Rewrite any code that makes use of these or any other undocumented methods. For example the jQuery.parseHTML()
method, introduced in jQuery 1.8, can convert HTML to an array of DOM elements that you can append to a document fragment.
Examples of incorrect code for this rule:
$.buildFragment()
Examples of correct code for this rule:
(none provided)
Further reading:
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-clean
Cause: jQuery.buildFragment()
and jQuery.clean()
are undocumented internal methods. The signature of jQuery.buildFragment()
was changed in jQuery 1.8 and 1.9, and jQuery.clean()
was removed in 1.9. However, we are aware of some plugins or other code that might be using them.
Solution: Rewrite any code that makes use of these or any other undocumented methods. For example the jQuery.parseHTML()
method, introduced in jQuery 1.8, can convert HTML to an array of DOM elements that you can append to a document fragment.
Examples of incorrect code for this rule:
$.clean()
Examples of correct code for this rule:
(none provided)
Further reading:
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-deferred-pipe
The .pipe() method on a jQuery.Deferred object was deprecated as of jQuery 1.8, when the .then() method was changed to perform the same function.
In most cases it is sufficient to change all occurrences of .pipe() to .then(). Ensure that you aren't relying on context/state propagation (e.g., using this) or synchronous callback invocation, which were dropped from .then() for Promises/A+ interoperability as of jQuery 3.0.
Examples of incorrect code for this rule:
$.Deferred().pipe(fn)
Examples of correct code for this rule:
$.Deferred().then(fn)
Further reading:
- v1.9
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-deprecated-event-methods
Many shortcut methods for attaching certain event handlers to elements were
deprecated in jQuery 1.8/1.9, such as $.fn.load
, $.fn.error
, etc.
For most cases, simply changing the code to use $.fn.on('<event>', handler)
instead will suffice, eg
Examples of incorrect code for this rule:
$('.foo').error(handler)
$('.foo').find('.bar').error(handler)
jQuery('.foo').error(handler)
$foo.error(handler)
$('.foo').load(handler)
$('.foo').unload(handler)
Examples of correct code for this rule:
$('.foo').on('error', handler)
$('.foo').find('.bar').on('error', handler)
jQuery('.foo').on('error', handler)
$foo.on('error', handler)
$('.foo').on('load', handler)
$('.foo').on('unload', handler)
Further reading:
- JQMIGRATE: jQuery.fn.error() is deprecated
- JQMIGRATE: jQuery.fn.load() is deprecated
- JQMIGRATE: jQuery.fn.unload() is deprecated
.error()
.load()
.unload()
.on()
- v1.9
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-die
.die()
was removed in jQuery 1.9 - use .off()
instead.
Examples of incorrect code for this rule:
$('.something').die('click')
Examples of correct code for this rule:
$('body').off('click', '.something')
Further reading:
- v1.9
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-document-on-ready
Cause: Using one of jQuery's API methods to bind a "ready" event, e.g. $( document ).on( "ready", fn )
, will cause the function to be called when the document is ready, but only if it is attached before the browser fires its own DOMContentLoaded
event. That makes it unreliable for many uses, particularly ones where jQuery or its plugins are loaded asynchronously after page load.
Solution: Replace any use of $( document ).on( "ready", fn )
with $( document ).ready( fn )
or more simply, just $( fn )
. These alternative methods work reliably even when the document is already loaded.
Examples of incorrect code for this rule:
$(document).on("ready", callback)
Examples of correct code for this rule:
$(document).ready(callback)
$(callback)
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-fn-data-events
Prior to 1.9, .data("events") could be used to retrieve jQuery's undocumented internal event data structure for an element if no other code had defined a data element with the name "events". This special case has been removed in 1.9.
There is no public interface to retrieve this internal data structure, and it remains undocumented. The only useful applications might be for debugging. The data is available via jQuery._data("events") but this is not a documented interface.
If this rule is flagging up code where an element is known to have custom data with the name "events", either use a different name to avoid confusion, or disable the rule for that particular piece of code:
$('.foo').data('events', 'my-custom-event-data')
// ...snip...
// eslint-disable-next-line jquery-compat/no-fn-data-events
var customEventData = $('.foo').data('events')
Examples of incorrect code for this rule:
$('.foo').data('events')
Examples of correct code for this rule:
$('.foo').data('custom-events')
Further reading:
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-fn-size
The .size() method returns the number of elements in the current jQuery object, but duplicates the more-efficient .length property which provides the same functionality. As of jQuery 1.9 the .length property is the preferred way to retrieve this value.
Solution: Replace any use of .size() with .length.
Examples of incorrect code for this rule:
$('.foo').size()
Examples of correct code for this rule:
$('.foo').length
Further reading:
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-global-handle
Cause: jQuery.event.handle
was never documented, and deprecated with jQuery 1.7 (see http://forum.jquery.com/topic/deprecated-event-properties-used-in-jquery). As of jQuery 1.9, it has been removed.
Solution: Use documented jQuery APIs, such as .trigger
.
Examples of incorrect code for this rule:
jQuery.event.handle
Examples of correct code for this rule:
(none provided)
Further reading:
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-global-trigger
Cause: jQuery 1.9 does not support globally triggered events. The only documented global events were the AJAX events and they are now triggered only on document
as discussed above. jQuery never provided a documented interface for outside code to trigger global events.
Solution: Change the program to avoid the use of global events. The jQuery Migrate plugin warns about this case but does not restore the previous behavior since it was undocumented.
Examples of incorrect code for this rule:
$.event.trigger(/*...*/)
Examples of correct code for this rule:
(none provided)
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-v1.9.1
- fixable-from-v1.10.0
- fixable-from-v1.10.1
- fixable-from-v1.10.2
- fixable-from-v1.11.0
- fixable-from-v1.11.1
- fixable-from-v1.11.2
- fixable-from-v1.11.3
- fixable-from-v1.12.0
- fixable-from-v1.12.1
- fixable-from-v1.12.2
- fixable-from-v1.12.3
- fixable-from-v1.12.4
- fixable-from-v2.0.0
- fixable-from-v2.0.1
- fixable-from-v2.0.2
- fixable-from-v2.0.3
- fixable-from-v2.1.0
- fixable-from-v2.1.1
- fixable-from-v2.1.2
- fixable-from-v2.1.3
- fixable-from-v2.1.4
- fixable-from-v2.2.0
- fixable-from-v2.2.1
- fixable-from-v2.2.2
- fixable-from-v2.2.3
- fixable-from-v2.2.4
- fixable-from-v3.0.0
- fixable-from-v3.1.0
- fixable-from-v3.1.1
- fixable-from-v3.2.0
- fixable-from-v3.2.1
- fixable-from-v3.3.0
- fixable-from-v3.3.1
- fixable-from-v3.4.0
- fixable-from-v3.4.1
@frogeducation/jquery-compat/no-hover-event
Cause: Until jQuery 1.9, the string "hover" was allowed as an alias for the string "mouseenter mouseleave" when attaching an event handler. This unusual exception provided no real benefit and prevented the use of the name "hover" as a triggered event. Note: This is not related to the .hover()
method, which has not been deprecated.
Solution: Replace use of the string "hover" with "mouseenter mouseleave" within any .on()
, .bind()
, .delegate()
, or .live()
event binding method.
Examples of incorrect code for this rule:
$foo.on("hover", callback)
Examples of correct code for this rule:
$foo.on("mouseenter mouseleave", inOutCallback)
$foo.on("mouseenter", inCallback)
$foo.hover(inCallback, outCallback)
$foo.hover(inOutCallback)
Further reading:
- v1.9
- fixable-from-v1.0.0
- fixable-from-v1.0.1
- fixable-from-v1.0.2
- fixable-from-v1.0.3
- fixable-from-v1.0.4
- fixable-from-v1.1.0
- fixable-from-v1.1.1
- fixable-from-v1.1.2
- fixable-from-v1.1.3
- fixable-from-v1.1.4
- fixable-from-v1.2.0
- fixable-from-v1.2.1
- fixable-from-v1.2.2
- fixable-from-v1.2.3
- fixable-from-v1.2.4
- fixable-from-v1.2.5
- fixable-from-v1.2.6
- fixable-from-v1.3.0
- fixable-from-v1.3.0
- fixable-from-v1.3.1
- fixable-from-v1.3.2
- fixable-from-v1.4.0
- fixable-from-v1.4.0
- fixable-from-v1.4.1
- fixable-from-v1.4.2
- fixable-from-v1.4.3
- fixable-from-v1.4.4
- fixable-from-v1.5.0
- fixable-from-v1.5.0
- fixable-from-v1.5.1
- fixable-from-v1.5.2
- fixable-from-v1.6.0
- fixable-from-v1.6.0
- fixable-from-v1.6.1
- fixable-from-v1.6.2
- fixable-from-v1.6.3
- fixable-from-v1.6.4
- fixable-from-v1.7.0
- fixable-from-v1.7.0
- fixable-from-v1.7.1
- fixable-from-v1.7.2
- fixable-from-v1.8.0
- fixable-from-v1.8.1
- fixable-from-v1.8.2
- fixable-from-v1.8.3
- fixable-from-v1.9.0
- fixable-from-