X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=tools%2Fhtdocs%2Fmkws.js;h=be3c9969c36c11c43187e9eedc09a6e9e17e1279;hb=02b2b955694909ba438dc434b568a24e0d1fbd9b;hp=2df7c1257f71f1c15c75bc81361ecc9372c4b649;hpb=5f4b0ba8b12474e57a93010ce18900ccac950825;p=mkws-moved-to-github.git diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 2df7c12..be3c996 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -917,16 +917,13 @@ function team($, teamName) { mkws_html_lang(); debug("HTML search form"); - // ### There is only one match here by design: fix not to bother looping - $('.mkwsSearch.mkwsTeam_' + m_teamName).each(function (i, obj) { - var node = this; - mkws.handle_node_with_team(this, function(tname) { - $(node).html('\ + mkws.handle_node_with_team($('.mkwsSearch.mkwsTeam_' + m_teamName), + function(tname) { + this.html('\
\ \ \
'); - }); }); debug("HTML records"); @@ -1240,7 +1237,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; @@ -1252,7 +1258,7 @@ function team($, teamName) { type = cname.replace(/^mkws/, ''); } } - callback.call(this, teamName, type); + callback.call(node, teamName, type); }