Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Couple of cleanups in RelatedObjectLookups.js

Thanks George Karpenkov.
  • Loading branch information...
commit 828359e52dd8f190a577442a88517e1ba9ba8da0 1 parent a3242dc
@timgraham timgraham authored
View
8 django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
@@ -55,7 +55,7 @@ function dismissRelatedLookupPopup(win, chosenId) {
function showAddAnotherPopup(triggeringLink) {
var name = triggeringLink.id.replace(/^add_/, '');
name = id_to_windowname(name);
- href = triggeringLink.href
+ var href = triggeringLink.href;
if (href.indexOf('?') == -1) {
href += '?_popup=1';
} else {
@@ -73,10 +73,11 @@ function dismissAddAnotherPopup(win, newId, newRepr) {
newRepr = html_unescape(newRepr);
var name = windowname_to_id(win.name);
var elem = document.getElementById(name);
+ var o;
if (elem) {
var elemName = elem.nodeName.toUpperCase();
if (elemName == 'SELECT') {
- var o = new Option(newRepr, newId);
+ o = new Option(newRepr, newId);
elem.options[elem.options.length] = o;
o.selected = true;
} else if (elemName == 'INPUT') {
@@ -88,8 +89,7 @@ function dismissAddAnotherPopup(win, newId, newRepr) {
}
} else {
var toId = name + "_to";
- elem = document.getElementById(toId);
- var o = new Option(newRepr, newId);
+ o = new Option(newRepr, newId);
SelectBox.add_to_cache(toId, o);
SelectBox.redisplay(toId);
}
Please sign in to comment.
Something went wrong with that request. Please try again.