Bug 824324 - Fix JavaScript strict warning: chrome://global/content/bindings/radio.xml, line 133: reference to undefined property val.value - set selected items in a radiogroup to real radio items, not random children elements. r=IanN
authoraceman <acelists@atlas.sk>
Mon, 04 Feb 2013 13:40:45 -0500
changeset 14792 35d92e1faf46ea2e41d87633929eec9317d089f1
parent 14791 ba078a9cce9db430c0781c1c1f3c26ebaeb8ef4b
child 14793 89fa8b687178cd60e8e98f9a1893361aa6116aad
push id867
push userbugzilla@standard8.plus.com
push dateMon, 01 Apr 2013 20:44:27 +0000
treeherdercomm-beta@797726b8d244 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN
bugs824324
Bug 824324 - Fix JavaScript strict warning: chrome://global/content/bindings/radio.xml, line 133: reference to undefined property val.value - set selected items in a radiogroup to real radio items, not random children elements. r=IanN
mailnews/base/prefs/content/AccountManager.js
--- a/mailnews/base/prefs/content/AccountManager.js
+++ b/mailnews/base/prefs/content/AccountManager.js
@@ -1245,47 +1245,35 @@ function getFormElementValue(formElement
   catch (ex) {
     dump("getFormElementValue failed, ex="+ex+"\n");
   }
   return null;
 }
 
 // sets the value of a widget
 function setFormElementValue(formElement, value) {
-
-  //formElement.value = formElement.defaultValue;
-  //  formElement.checked = formElement.defaultChecked;
   var type = formElement.localName;
   if (type == "checkbox") {
     if (value == undefined) {
       if ("defaultChecked" in formElement && formElement.defaultChecked)
         formElement.checked = formElement.defaultChecked;
       else
         formElement.checked = false;
     } else {
       if (formElement.getAttribute("reversed"))
         formElement.checked = !value;
       else
         formElement.checked = value;
     }
   }
-
   else if (type == "radiogroup" || type =="menulist") {
-
-    var selectedItem;
-    if (value == undefined) {
-      if (type == "radiogroup")
-        selectedItem = formElement.firstChild;
-      else
-        selectedItem = formElement.firstChild.firstChild;
-    }
+    if (value == undefined)
+      formElement.selectedIndex = 0;
     else
-      selectedItem = formElement.getElementsByAttribute("value", value)[0];
-
-    formElement.selectedItem = selectedItem;
+      formElement.value = value;
   }
   // handle nsILocalFile
   else if (type == "textbox" &&
            formElement.getAttribute("datatype") == "nsILocalFile") {
     if (value) {
       var localfile = value.QueryInterface(Components.interfaces.nsILocalFile);
       try {
         formElement.value = localfile.path;