36 lines
811 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
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++``
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
var input = $( "form input:radio" ); // Noncompliant
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
var input = $( "form input[type=radio]" ); // Compliant
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]