/* * $_ * * Returns the element with the specified |name| attribute. */ function $_(formNum, name) { var form = document.getElementById("form" + formNum); if (!form) { logWarning("$_ couldn't find requested form " + formNum); return null; } var element = form.elements.namedItem(name); if (!element) { logWarning("$_ couldn't find requested element " + name); return null; } // Note that namedItem is a bit stupid, and will prefer an // |id| attribute over a |name| attribute when looking for // the element. Login Mananger happens to use .namedItem // anyway, but let's rigorously check it here anyway so // that we don't end up with tests that mistakenly pass. if (element.getAttribute("name") != name) { logWarning("$_ got confused."); return null; } return element; } /* * checkForm * * Check a form for expected values. If an argument is null, a field's * expected value will be the default value. * *