Fixed #10783 -- Fixed Javascript error when adding a new object in admin.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10516 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2009-04-11 11:33:10 +00:00
parent f4072f5be8
commit 0d2cf7bdd6
1 changed files with 2 additions and 2 deletions

View File

@ -38,8 +38,8 @@ document.getElementsBySelector = function(selector) {
var tagName = bits[0]; var tagName = bits[0];
var id = bits[1]; var id = bits[1];
var element = document.getElementById(id); var element = document.getElementById(id);
if (tagName && element.nodeName.toLowerCase() != tagName) { if (!element || (tagName && element.nodeName.toLowerCase() != tagName)) {
// tag with that ID not found, return false // ID not found or tag with that ID not found, return false.
return new Array(); return new Array();
} }
// Set currentContext to contain just this element // Set currentContext to contain just this element