From 13cf2b48e159913e2bfd965394badc03d74b2131 Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Thu, 9 May 2019 18:06:10 +0900 Subject: [PATCH] use jQuery DOM manipulation instead of raw JS --- .../nodes/core/core/lib/debug/debug-utils.js | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/core/lib/debug/debug-utils.js b/packages/node_modules/@node-red/nodes/core/core/lib/debug/debug-utils.js index 47f64e887..edc349507 100644 --- a/packages/node_modules/@node-red/nodes/core/core/lib/debug/debug-utils.js +++ b/packages/node_modules/@node-red/nodes/core/core/lib/debug/debug-utils.js @@ -400,48 +400,47 @@ RED.debug = (function() { } function processDebugMessage(o) { - var msg = document.createElement("div"); + var msg = $("
"); var sourceNode = o._source; - msg.onmouseenter = function() { - $(msg).addClass('debug-message-hover'); + msg.on("mouseenter", function() { + msg.addClass('debug-message-hover'); if (o._source) { config.messageMouseEnter(o._source.id); if (o._source._alias) { config.messageMouseEnter(o._source._alias); } } - - }; - msg.onmouseleave = function() { - $(msg).removeClass('debug-message-hover'); + }); + msg.on("mouseleave", function() { + msg.removeClass('debug-message-hover'); if (o._source) { config.messageMouseLeave(o._source.id); if (o._source._alias) { config.messageMouseLeave(o._source._alias); } } - }; + }); var name = sanitize(((o.name?o.name:o.id)||"").toString()); var topic = sanitize((o.topic||"").toString()); var property = sanitize(o.property?o.property:''); var payload = o.msg; var format = sanitize((o.format||"").toString()); - msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'')+ + msg.attr("class", 'debug-message'+(o.level?(' debug-message-level-'+o.level):'')+ (sourceNode?( " debug-message-node-"+sourceNode.id.replace(/\./g,"_")+ (sourceNode.z?" debug-message-flow-"+sourceNode.z.replace(/\./g,"_"):"") - ):""); + ):"")); if (sourceNode) { - $(msg).data('source',sourceNode.id); + msg.data('source',sourceNode.id); if (filterType === "filterCurrent" && activeWorkspace) { if (sourceNode.z && sourceNode.z.replace(/\./g,"_") !== activeWorkspace) { - $(msg).addClass('hide'); + msg.addClass('hide'); } } else if (filterType === 'filterSelected'){ if (!!filteredNodes[sourceNode.id]) { - $(msg).addClass('hide'); + msg.addClass('hide'); } } } @@ -481,7 +480,7 @@ RED.debug = (function() { errorLvl = 30; errorLvlType = 'warn'; } - $(msg).addClass('debug-message-level-' + errorLvl); + msg.addClass('debug-message-level-' + errorLvl); $('function : (' + errorLvlType + ')').appendTo(metaRow); } else { var tools = $('').appendTo(metaRow);