Test name | Executions per second |
---|---|
with selected selector | 87193.2 Ops/sec |
with selected selector in filter | 91896.0 Ops/sec |
<select id="items">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
<option value="4"></option>
<option value="5"></option>
<option value="6"></option>
<option value="7"></option>
<option value="8"></option>
<option value="9"></option>
<option value="10"></option>
</select>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js'></script>
var $itemsElement = $("#items");
$itemsElement.val("5");
$itemsElement.find("option:selected");
$itemsElement.find("option").filter(":selected");