jQuery class vs attribute selectors (v6)

Revision 6 of this benchmark created on


Description

Test performance of jQuery of using the class selector ".classname" vs the attribute selector "[class='classname']"

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<a data-multiplevalues="valuea valueb valuec">Test</a>

Test runner

Ready to run.

Testing in
TestOps/sec
class selector
var content = $("a[data-multiplevalues^='valuea']");
ready
attribute selector
var content = $("a[data-multiplevalues*='valuea']");
ready
attribute contains selector
var content = $("a[data-multiplevalues~='valuea']");
ready
attribute contains word
 
ready
attribute not equal selector
 
ready
attribute selector (data attribute)
 
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.