Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#7406 closed bug (invalid)

Infinite loop in IE6 using option:selected

Reported by: phil.robare@… Owned by: phil.robare@…
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.


Change History (5)

comment:1 Changed 6 years ago by snover

Owner: set to phil.robare@…
Status: newpending

Please provide a reproducible test case on jsFiddle.

comment:2 Changed 6 years ago by Rick Waldron

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()"?

comment:3 Changed 6 years ago by Rick Waldron

works for me in IE 6,7,8


comment:4 Changed 6 years ago by phil.robare@…

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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
	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.

comment:5 Changed 6 years ago by Rick Waldron

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

Last edited 6 years ago by Rick Waldron (previous) (diff)
Note: See TracTickets for help on using tickets.