Bug 496235 - Menulist should not set current item to null when using an out-of-range value for selectedIndex. r=enn
authorHenrik Skupin <hskupin@gmail.com>
Fri, 14 Aug 2009 23:16:02 +0200
changeset 31571 aff827e779e6e94e0a44deb465c79c02996e02fc
parent 31570 8f77197a8f99c3a3fdf988033966e0139b604bca
child 31572 59cfe19eca0b921790ae9ba5d52ebb1d1503bf89
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenn
bugs496235
milestone1.9.3a1pre
Bug 496235 - Menulist should not set current item to null when using an out-of-range value for selectedIndex. r=enn
toolkit/content/widgets/menulist.xml
--- a/toolkit/content/widgets/menulist.xml
+++ b/toolkit/content/widgets/menulist.xml
@@ -176,21 +176,23 @@
                 break;
 
             return i;
           ]]>
         </getter>
         <setter>
           <![CDATA[
             var popup = this.menupopup;
-            if (popup && 0 <= val && val < popup.childNodes.length)
-              this.selectedItem = popup.childNodes[val];
+            if (popup && 0 <= val) {
+              if (val < popup.childNodes.length)
+                this.selectedItem = popup.childNodes[val];
+            }
             else
               this.selectedItem = null;
-            return val;    
+            return val;
           ]]>
         </setter>
       </property>
 
       <property name="selectedItem">
         <getter>
           <![CDATA[
             return this.mSelectedInternal;