Author: mtredinnick Date: 2009-04-11 06:32:50 -0500 (Sat, 11 Apr 2009) New Revision: 10515
Modified: django/trunk/django/contrib/admin/media/js/actions.js Log: Fixed #10782 -- Fixed a Javascript error in the admin. Viewing an empty changelist page no longer attempts to attach event listeners to an undefined object. Modified: django/trunk/django/contrib/admin/media/js/actions.js =================================================================== --- django/trunk/django/contrib/admin/media/js/actions.js 2009-04-11 09:27:04 UTC (rev 10514) +++ django/trunk/django/contrib/admin/media/js/actions.js 2009-04-11 11:32:50 UTC (rev 10515) @@ -8,15 +8,17 @@ }); } var changelistTable = document.getElementsBySelector('#changelist table')[0]; - addEvent(changelistTable, 'click', function(e) { - if (!e) { var e = window.event; } - var target = e.target ? e.target : e.srcElement; - if (target.nodeType == 3) { target = target.parentNode; } - if (target.className == 'action-select') { - var tr = target.parentNode.parentNode; - Actions.toggleRow(tr, target.checked); - } - }); + if (changelistTable) { + addEvent(changelistTable, 'click', function(e) { + if (!e) { var e = window.event; } + var target = e.target ? e.target : e.srcElement; + if (target.nodeType == 3) { target = target.parentNode; } + if (target.className == 'action-select') { + var tr = target.parentNode.parentNode; + Actions.toggleRow(tr, target.checked); + } + }); + } }, toggleRow: function(tr, checked) { if (checked && tr.className.indexOf('selected') == -1) { --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---