Bug Tracker

Opened 13 years ago

Closed 12 years ago

Last modified 9 years ago

#2649 closed bug (worksforme)

Change between jquery 1.2.1 and 1.2.3 on the clone() function causes lag, freezing, and crashes some browsers.

Reported by: pthurmond Owned by:
Priority: major Milestone: 1.2.1
Component: core Version: 1.2.3
Keywords: clone, internet explorer, firefox Cc:
Blocked by: Blocking:

Description (last modified by davidserduke)

I upgraded to version 1.2.3 to fix a problem that occurs in Internet Explorer 6 and 7.

This problem is when using a function that was written to change the list of select options in one drop down when you select a particular option in another drop down.

I think the problem is caused by the clone() function. But I haven't been able to verify that for sure. I know it only happens in this function that I wrote. I will include my function below.

To be more specific on this, in 1.2.1 it would pause and take up to 90 seconds to finish executing, yet it worked perfectly in Firefox and Safari. Then I upgraded to 1.2.3 and it worked instantly and perfectly in IE7, in IE6 it worked a lot faster, in Safari, Firefox 2, and Firefox 3 Beta 4 it runs slow like IE6 and 7 did while on jquery 1.2.1. In the case of Firefox 3 Beta 5 it straight crashed the browser.

Again I am pretty sure it has to do with the bugfix in Ticket #2184 link: http://dev.jquery.com/ticket/2184

However I haven't been able to narrow it down any further. I have only included the relevant code. The setsel() function works when called by another event without any problems, so the problem is not coming from there. The event is the changing of a select option.

Here is my code...

  // Item class stuff
    var itemnum = this.id.substr(7,1);
    var iclass = this.value;

    classChange(itemnum, iclass);

function classChange(itemnum, iclass)
  newsel = $('tr.hiddenitem select.itemcomm').clone();

  if (iclass)
    // Remove items that don't match the selected frieght class
    newsel.find('option:not(.' + iclass +')').remove();

    // We just removed the blank option, so add it back in
    newsel.prepend("<option value=''></option>");

  newsel.attr({id: 'riitem' + itemnum}).change(function()
    setsel('riclass' + itemnum, itemclasses[this.value]);

  itd = $('select#riitem' + itemnum).parent();

  $('#riitem' + itemnum).val('');

function setsel(selid,newval)
  if (newval == null)
    return null;
  if (!newval)
    newval = "";
  $('select#' + selid).val(newval);

Change History (2)

comment:1 Changed 13 years ago by davidserduke

Description: modified (diff)

It's a bit hard to see in the changeset [4513] but the fix for #2184 was an IE specific change. So it shouldn't have made any difference to firefox, et al. There have been a bunch of other changes to clone since 1.2.1 trying to find a decent solution, so it is still possible clone is the culprit.

comment:2 Changed 12 years ago by brandon

Resolution: worksforme
Status: newclosed

Please feel free to reopen if things are still running slow on the latest build of jQuery 1.3.x

Note: See TracTickets for help on using tickets.