From d3b27e0d579da1535397fe464b5fb0476f0c0020 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 28 Feb 2014 12:31:10 +0000 Subject: [PATCH] mkws.handle_node_with_team() now works with both DOM nodes and jQuery objects. Previously it handled only the former. For some retarded reason related to the JavaScript runtime, if it was given the latter (so that node.className was undefined), pushing on and assigning list = classes.split(/\s+/) would not yield an error message: instead, this function and its callers, up several stack level, silently return. What a crock. This took FOREVER to find. --- tools/htdocs/mkws.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index ca77487..75a88c7 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -1240,7 +1240,16 @@ function team($, teamName) { mkws.handle_node_with_team = function(node, callback) { - var classes = node.className; + // First branch for DOM objects; second branch for jQuery objects + var classes = node.className || node.attr('class'); + if (!classes) { + // For some reason, if we try to proceed when classes is + // undefined, we don't get an error message, but this + // function and its callers, up several stack level, + // silently return. What a crock. + mkws.debug("handle_node_with_team() called on node with no classes"); + return; + } var list = classes.split(/\s+/) var teamName, type; -- 1.7.10.4