Bug 596959 - undefined property aField[attr] into FormAutoComplete.js [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Thu, 16 Sep 2010 20:50:36 +0200
changeset 66662 db1051dc93c144d32fdb42d9d1b5bc62fbcbec3e
parent 66661 5683eaa960b407d268a4a868236dd71206afe803
child 66663 0407a246fc73338a8252f36dcecebd6f61a1de81
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)
reviewersmfinkle
bugs596959
Bug 596959 - undefined property aField[attr] into FormAutoComplete.js [r=mfinkle]
mobile/components/FormAutoComplete.js
--- a/mobile/components/FormAutoComplete.js
+++ b/mobile/components/FormAutoComplete.js
@@ -83,21 +83,20 @@ FormAutoComplete.prototype = {
       let type = aField.type;
       if (this.contactTypes[type] != null)
         return type;
     }
 
     // Grab properties to check for contact inputs
     let props = [aName];
     if (aField) {
-      let specialProps = ["className", "id", "rel"];
-      specialProps.forEach(function(attr) {
-        if (attr in aField)
-          props.push(aField[attr]);
-      });
+      let specialProps = [aField["className"], aField["id"], aField["rel"]];
+      props = props.concat(props.filter(function(aValue) {
+        return aValue;
+      }));
     }
 
     // Check the gathered properties for contact-like values
     for (let [type, regex] in Iterator(this.contactTypes)) {
       if (props.some(function(prop) prop.search(regex) != -1))
         return type;
     }
     return null;