From db7b99e8ccba2ebf81a345157de5a90ba5387626 Mon Sep 17 00:00:00 2001
From: Ben Shum <bshum@biblio.org>
Date: Fri, 31 Jan 2014 15:45:08 -0500
Subject: [PATCH] Revert "Eliminate an annoying and useless warning in the
 JavaScript Console."

This reverts commit bb4a797010201d6f26156c9e921d78690f265e35.

My fault for picking this in without more testing. This broke things like noted
in LP1275074.
---
 .../chrome/content/OpenILS/global_util.js          | 108 ++++++++++-----------
 1 file changed, 53 insertions(+), 55 deletions(-)

diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
index 6a9332f26c..d1be18631d 100644
--- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
+++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
@@ -351,71 +351,69 @@
                     }
                 }
                 var cmd = nodes[i].getAttribute('command');
-                if (cmd) {
-                    var cmd_el = document.getElementById(cmd);
-                    if (nodes[i].disabled == false && nodes[i].hidden == false) {
-                        var no_poke = nodes[i].getAttribute('oils_persist_no_poke');
-                        if (no_poke && no_poke == 'true') {
-                            // Timing issue for some checkboxes; don't poke them with an event
-                            dump('\tnot poking\n');
+                var cmd_el = document.getElementById(cmd);
+                if (nodes[i].disabled == false && nodes[i].hidden == false) {
+                    var no_poke = nodes[i].getAttribute('oils_persist_no_poke');
+                    if (no_poke && no_poke == 'true') {
+                        // Timing issue for some checkboxes; don't poke them with an event
+                        dump('\tnot poking\n');
+                    } else {
+                        if (cmd_el) {
+                            dump('\tpoking @command\n');
+                            var evt = document.createEvent("Events");
+                            evt.initEvent( 'command', true, true );
+                            cmd_el.dispatchEvent(evt);
                         } else {
-                            if (cmd_el) {
-                                dump('\tpoking @command\n');
-                                var evt = document.createEvent("Events");
-                                evt.initEvent( 'command', true, true );
-                                cmd_el.dispatchEvent(evt);
-                            } else {
-                                dump('\tpoking\n');
-                                var evt = document.createEvent("Events");
-                                evt.initEvent( 'command', true, true );
-                                nodes[i].dispatchEvent(evt);
-                            }
+                            dump('\tpoking\n');
+                            var evt = document.createEvent("Events");
+                            evt.initEvent( 'command', true, true );
+                            nodes[i].dispatchEvent(evt);
                         }
                     }
-                    if (cmd_el) {
-                        window.persist_helper_event_listeners.add(cmd_el, 
-                            'command',
-                            gen_event_handler('command',cmd_el),
-                            false
-                        );
-                        window.persist_helper_event_listeners.add(cmd_el, 
-                            'oils_persist',
-                            gen_oils_persist_handler( base_key, nodes[i] ),
-                            false
-                        );
+                }
+                if (cmd_el) {
+                    window.persist_helper_event_listeners.add(cmd_el, 
+                        'command',
+                        gen_event_handler('command',cmd_el),
+                        false
+                    );
+                    window.persist_helper_event_listeners.add(cmd_el, 
+                        'oils_persist',
+                        gen_oils_persist_handler( base_key, nodes[i] ),
+                        false
+                    );
+                } else {
+                    var node = nodes[i];
+                    var event_types = [];
+                    if (node.hasAttribute('oils_persist_events')) {
+                        var event_type_list = node.getAttribute('oils_persist_events').split(' ');
+                        for (var j = 0; j < event_type_list.length; j++) {
+                            event_types.push( event_type_list[j] );
+                        }
                     } else {
-                        var node = nodes[i];
-                        var event_types = [];
-                        if (node.hasAttribute('oils_persist_events')) {
-                            var event_type_list = node.getAttribute('oils_persist_events').split(' ');
-                            for (var j = 0; j < event_type_list.length; j++) {
-                                event_types.push( event_type_list[j] );
-                            }
+                        if (node.nodeName == 'textbox') { 
+                            event_types.push('change');
+                        } else if (node.nodeName == 'menulist') { 
+                            event_types.push('select');  
+                        } else if (node.nodeName == 'window') {
+                            event_types.push('resize'); 
+                            node = window; // xul window is an element of window.document
                         } else {
-                            if (node.nodeName == 'textbox') { 
-                                event_types.push('change');
-                            } else if (node.nodeName == 'menulist') { 
-                                event_types.push('select');  
-                            } else if (node.nodeName == 'window') {
-                                event_types.push('resize'); 
-                                node = window; // xul window is an element of window.document
-                            } else {
-                                event_types.push('command'); 
-                            }
-                        }
-                        for (var j = 0; j < event_types.length; j++) {
-                            window.persist_helper_event_listeners.add(node, 
-                                event_types[j],
-                                gen_event_handler(event_types[j],node),
-                                false
-                            );
+                            event_types.push('command'); 
                         }
+                    }
+                    for (var j = 0; j < event_types.length; j++) {
                         window.persist_helper_event_listeners.add(node, 
-                            'oils_persist',
-                            gen_oils_persist_handler( base_key, node ),
+                            event_types[j],
+                            gen_event_handler(event_types[j],node),
                             false
                         );
                     }
+                    window.persist_helper_event_listeners.add(node, 
+                        'oils_persist',
+                        gen_oils_persist_handler( base_key, node ),
+                        false
+                    );
                 }
             }
         } catch(E) {
-- 
2.11.0