Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10515 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f4072f5be8477fdba485d9594c0c3ce2aca1d11b 1 parent 8dc73e8
Malcolm Tredinnick authored

Showing 1 changed file with 11 additions and 9 deletions. Show diff stats Hide diff stats

  1. 20  django/contrib/admin/media/js/actions.js
20  django/contrib/admin/media/js/actions.js
@@ -8,15 +8,17 @@ var Actions = {
8 8
             });
9 9
         }
10 10
         var changelistTable = document.getElementsBySelector('#changelist table')[0];
11  
-        addEvent(changelistTable, 'click', function(e) {
12  
-            if (!e) { var e = window.event; }
13  
-            var target = e.target ? e.target : e.srcElement;
14  
-            if (target.nodeType == 3) { target = target.parentNode; }
15  
-            if (target.className == 'action-select') {
16  
-                var tr = target.parentNode.parentNode;
17  
-                Actions.toggleRow(tr, target.checked);
18  
-            }
19  
-        });
  11
+        if (changelistTable) {
  12
+            addEvent(changelistTable, 'click', function(e) {
  13
+                if (!e) { var e = window.event; }
  14
+                var target = e.target ? e.target : e.srcElement;
  15
+                if (target.nodeType == 3) { target = target.parentNode; }
  16
+                if (target.className == 'action-select') {
  17
+                    var tr = target.parentNode.parentNode;
  18
+                    Actions.toggleRow(tr, target.checked);
  19
+                }
  20
+            });
  21
+        }
20 22
     },
21 23
     toggleRow: function(tr, checked) {
22 24
         if (checked && tr.className.indexOf('selected') == -1) {

0 notes on commit f4072f5

Please sign in to comment.
Something went wrong with that request. Please try again.