Skip to main content

Bug Tracker

Side navigation

#7406 closed bug (invalid)

Opened November 04, 2010 11:28PM UTC

Closed November 05, 2010 05:50PM UTC

Last modified March 13, 2012 06:09PM UTC

Infinite loop in IE6 using option:selected

Reported by: Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:

In IE 6 (Service Pack 3):

[yeh, I'd like to drop support for it too]

In order to get a trigger to fire in both FireFox and IE when changing a drop-down style single select list I tried:

    jQuery(function() {

This did not work in IE (it did in Firefox), to get it to work in both I had to code:

    jQuery(function() {
            $.browser.msie ? 'propertychange': 'change',

Finding the selected value was a problem too.

t=$('.ErrorNameDropDown option:selected').first().text();

The preceeding code went into an infinite loop in IE. The following code, which I think is equivalent, worked. Both versions worked in Firefox.


Attachments (0)
Change History (5)

Changed November 04, 2010 11:43PM UTC by snover comment:1

owner: →
status: newpending

Please provide a reproducible test case on jsFiddle.

Changed November 04, 2010 11:59PM UTC by rwaldron comment:2

I'm just curious about this...

This code:

jQuery(function() {

Will listen for an event and handle it - not fire an event.

$('.ErrorNameDropDown option:selected').first().text();

:selected would only return 1 item, so why specify "first()"?

Changed November 05, 2010 12:08AM UTC by rwaldron comment:3

works for me in IE 6,7,8

Changed November 05, 2010 03:43PM UTC by comment:4

status: pendingnew

I generated an example page that shows that the code goes into an infinite loop in IE. I tested it in both IE6 and IE7 with the same results. It works fine in jsFiddle and Firefox (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20101026 Firefox/3.6.12). The point of the bug is the broken javascript execution in IE has to be worked around. Here is the page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
	Example for jQuery bug 7406
    <script type="text/javascript" src="jquery-1.4.3.min.js" ></script>
    <meta http-equiv="Content-Script-Type" content="text/javascript" /></head>
    <form name="form1" method="post" action="Default.aspx" id="form1">

    <select name="ErrorName" id="ErrorName" class="ErrorNameDropDown">
	<option value="0"> --unset--</option>
	<option value="1">1.0 Spilled Milk</option>
	<option value="2">5.0 Broken Window</option>
	<option value="3">10.0 Incensed Relative</option>
	<option value="4">15.0 Dead Body</option>

    <select name="ErrorType" id="ErrorType" class="ErrorClassDropDown">
	<option selected="selected" value="0"> --unset--</option>
	<option value="1">Non-Critical</option>
	<option value="2">Critical</option>

    <input name="ErrorComment" type="text" id="ErrorComment" />

	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWCgK6zKUJAt+s24MPAsCs24MPAsGs24MPAsKs24MPAsOs24MPAueWtKcEAviWtKcEAvmWtKcEAvCSr64KYMzeRUEF+CG8mPPM8bXH86ZxSX4=" />
        <script type="text/javascript">
    // When the value in error type is changed change the severity value to the
    // default severity for that error
    var old_t = 0;
    function setDefaultSeverity() {
        t=$('.ErrorNameDropDown option:selected').first().text();
        if (t == old_t) return;
        old_t = t;
        if (t.match('^[0-9][0-9]')) { // critical errors start with two digits
        } else {

    // on redirect jQuery is unassigned, IE reports an error
    if (jQuery)
    jQuery(function() {
        try {
            $.browser.msie ? 'propertychange': 'change', setDefaultSeverity);
        } catch(e) {}


In response to rwaldron's questions: 1) The difference between binding to an event and handling an event is lost on me. I just got to where my code worked in both browsers. 2)I used .first() out of an excess of caution since a multi-select list might have more than one selected.

Changed November 05, 2010 05:50PM UTC by rwaldron comment:5

_comment0: Fixed. Please take a look at this: \ \ \ \ I made a few changes to your code, and its works perfectly on IE6 & 7 \ \ I suspect that the issue was your RegExp \ 1288979425839620
resolution: → invalid
status: newclosed

Fixed. Please take a look at this:

I made a few changes to your code, and its works perfectly on IE6 & 7. I commented the changes I made

I suspect that the issue was your RegExp