2021-04-28 18:08:03 +02:00

28 lines
650 B
Plaintext

While ``++:<element_type>++`` and ``++[type="<element_type>"]++`` can both be used in jQuery to select elements by their type, ``++[type="<element_type>"]++`` is far faster because it can take advantage of the native DOM ``++querySelectorAll()++`` method in modern browsers.
This rule raises an issue when following selectors are used:
* ``++:checkbox++``
* ``++:file++``
* ``++:image++``
* ``++:password++``
* ``++:radio++``
* ``++:reset++``
* ``++:text++``
== Noncompliant Code Example
----
var input = $( "form input:radio" ); // Noncompliant
----
== Compliant Solution
----
var input = $( "form input[type=radio]" ); // Compliant
----