Better performance for selecting options by value with jQuery?
<p>I am trying to work out some performance problems with some JavaScript I've been working on for a few days.  One of the pieces of the functions is below:</p>

<pre><code>var removeAddress = function(pk) {
    var startTime = new Date();
    jQuery('.add_driver select.primary_address:has(option[value=' + pk + ']:selected)').each(function(c, o) {
        console.log("Shouldn't get here yet...");
        showInputs(o);
    });
    console.log('removeAddress1:  ', (new Date() - startTime) / 1000);
    jQuery('.add_driver select.primary_address option[value=' + pk + ']').remove();
    console.log('removeAddress2:  ', (new Date() - startTime) / 1000);
};
</code></pre>

<p>This code is quite peppy in Firefox:</p>

<pre><code>removeAddress1:  0.004
removeAddress2: 0.023
</code></pre>

<p>But in IE8 it is another story:</p>

<pre><code>LOG: removeAddress1: 0.203
LOG: removeAddress2: 0.547
</code></pre>

<p>The form in question is a 20-person in put form with first name, last name, and 5 address fields.  I've also put in a drop down for selecting other addresses already existing in the form (<code>.primary_address</code>).  This code is removing an address from the primary address select boxes.  </p>

<p>I'm trying to nail down why this is taking so long, and the only thing which stands out is the <code>option[value=????]</code> section.  This was the most practical way to find the elements in question, so I ran with it.  Is there something about these two selectors which is causing IE to lose its lunch?</p>
