1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Avoid unnecessary use of .html() where .text() will do

This commit is contained in:
Nick O'Leary 2018-05-11 14:05:52 +01:00
parent 4fdd09a262
commit d49c7a3adb
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
12 changed files with 85 additions and 83 deletions

View File

@ -51,11 +51,11 @@ RED.diff = (function() {
var tabForLabel = (object.newTab || object.tab).n; var tabForLabel = (object.newTab || object.tab).n;
var titleSpan = $('<span>',{class:"node-diff-tab-title-meta"}).appendTo(originalCell); var titleSpan = $('<span>',{class:"node-diff-tab-title-meta"}).appendTo(originalCell);
if (tabForLabel.type === 'tab') { if (tabForLabel.type === 'tab') {
titleSpan.html(tabForLabel.label||tabForLabel.id); titleSpan.text(tabForLabel.label||tabForLabel.id);
} else if (tab.type === 'subflow') { } else if (tab.type === 'subflow') {
titleSpan.html((tabForLabel.name||tabForLabel.id)); titleSpan.text((tabForLabel.name||tabForLabel.id));
} else { } else {
titleSpan.html(RED._("diff.globalNodes")); titleSpan.text(RED._("diff.globalNodes"));
} }
var flowStats = { var flowStats = {
local: { local: {
@ -131,7 +131,7 @@ RED.diff = (function() {
} }
} }
$('<span class="node-diff-chevron"><i class="fa fa-angle-down"></i></span>').appendTo(originalNodeDiv); $('<span class="node-diff-chevron"><i class="fa fa-angle-down"></i></span>').appendTo(originalNodeDiv);
$('<span>').html(RED._("diff.flowProperties")).appendTo(originalNodeDiv); $('<span>').text(RED._("diff.flowProperties")).appendTo(originalNodeDiv);
row.click(function(evt) { row.click(function(evt) {
evt.preventDefault(); evt.preventDefault();
@ -206,7 +206,7 @@ RED.diff = (function() {
} }
} }
var localStats = $('<span>',{class:"node-diff-tab-stats"}).appendTo(localCell); var localStats = $('<span>',{class:"node-diff-tab-stats"}).appendTo(localCell);
$('<span class="node-diff-status"></span>').html(RED._('diff.nodeCount',{count:localNodeCount})).appendTo(localStats); $('<span class="node-diff-status"></span>').text(RED._('diff.nodeCount',{count:localNodeCount})).appendTo(localStats);
if (flowStats.conflicts + flowStats.local.addedCount + flowStats.local.changedCount + flowStats.local.deletedCount > 0) { if (flowStats.conflicts + flowStats.local.addedCount + flowStats.local.changedCount + flowStats.local.deletedCount > 0) {
$('<span class="node-diff-status"> [ </span>').appendTo(localStats); $('<span class="node-diff-status"> [ </span>').appendTo(localStats);
@ -245,7 +245,7 @@ RED.diff = (function() {
} }
} }
var remoteStats = $('<span>',{class:"node-diff-tab-stats"}).appendTo(remoteCell); var remoteStats = $('<span>',{class:"node-diff-tab-stats"}).appendTo(remoteCell);
$('<span class="node-diff-status"></span>').html(RED._('diff.nodeCount',{count:remoteNodeCount})).appendTo(remoteStats); $('<span class="node-diff-status"></span>').text(RED._('diff.nodeCount',{count:remoteNodeCount})).appendTo(remoteStats);
if (flowStats.conflicts + flowStats.remote.addedCount + flowStats.remote.changedCount + flowStats.remote.deletedCount > 0) { if (flowStats.conflicts + flowStats.remote.addedCount + flowStats.remote.changedCount + flowStats.remote.deletedCount > 0) {
$('<span class="node-diff-status"> [ </span>').appendTo(remoteStats); $('<span class="node-diff-status"> [ </span>').appendTo(remoteStats);
if (flowStats.conflicts > 0) { if (flowStats.conflicts > 0) {
@ -464,7 +464,7 @@ RED.diff = (function() {
wires.forEach(function(p,i) { wires.forEach(function(p,i) {
var port = $("<li>").appendTo(list); var port = $("<li>").appendTo(list);
if (p && p.length > 0) { if (p && p.length > 0) {
$("<span>").html(i+1).appendTo(port); $("<span>").text(i+1).appendTo(port);
var links = $("<ul>").appendTo(port); var links = $("<ul>").appendTo(port);
p.forEach(function(d) { p.forEach(function(d) {
c++; c++;
@ -474,15 +474,15 @@ RED.diff = (function() {
var def = RED.nodes.getType(node.type)||{}; var def = RED.nodes.getType(node.type)||{};
createNode(node,def).appendTo(entry); createNode(node,def).appendTo(entry);
} else { } else {
entry.html(d); entry.text(d);
} }
}) })
} else { } else {
port.html('none'); port.text('none');
} }
}) })
if (c === 0) { if (c === 0) {
result.html("none"); result.text("none");
} else { } else {
list.appendTo(result); list.appendTo(result);
} }
@ -507,7 +507,7 @@ RED.diff = (function() {
createNodeIcon(node,def).appendTo(nodeTitleDiv); createNodeIcon(node,def).appendTo(nodeTitleDiv);
var contentDiv = $('<div>',{class:"node-diff-node-description"}).appendTo(nodeTitleDiv); var contentDiv = $('<div>',{class:"node-diff-node-description"}).appendTo(nodeTitleDiv);
var nodeLabel = node.label || node.name || node.id; var nodeLabel = node.label || node.name || node.id;
$('<span>',{class:"node-diff-node-label"}).html(nodeLabel).appendTo(contentDiv); $('<span>',{class:"node-diff-node-label"}).text(nodeLabel).appendTo(contentDiv);
return nodeTitleDiv; return nodeTitleDiv;
} }
function createNodeDiffRow(node,stats,CurrentDiff) { function createNodeDiffRow(node,stats,CurrentDiff) {
@ -739,7 +739,7 @@ RED.diff = (function() {
var status; var status;
row = $("<tr>").appendTo(nodePropertiesTableBody); row = $("<tr>").appendTo(nodePropertiesTableBody);
$("<td>",{class:"node-diff-property-cell-label"}).html("id").appendTo(row); $("<td>",{class:"node-diff-property-cell-label"}).text("id").appendTo(row);
localCell = $("<td>",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row); localCell = $("<td>",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row);
if (localNode) { if (localNode) {
localCell.addClass("node-diff-node-unchanged"); localCell.addClass("node-diff-node-unchanged");
@ -782,7 +782,7 @@ RED.diff = (function() {
conflict = true; conflict = true;
} }
row = $("<tr>").appendTo(nodePropertiesTableBody); row = $("<tr>").appendTo(nodePropertiesTableBody);
$("<td>",{class:"node-diff-property-cell-label"}).html("position").appendTo(row); $("<td>",{class:"node-diff-property-cell-label"}).text("position").appendTo(row);
localCell = $("<td>",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row); localCell = $("<td>",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row);
if (localNode) { if (localNode) {
localCell.addClass("node-diff-node-"+(localChanged?"changed":"unchanged")); localCell.addClass("node-diff-node-"+(localChanged?"changed":"unchanged"));
@ -850,7 +850,7 @@ RED.diff = (function() {
conflict = true; conflict = true;
} }
row = $("<tr>").appendTo(nodePropertiesTableBody); row = $("<tr>").appendTo(nodePropertiesTableBody);
$("<td>",{class:"node-diff-property-cell-label"}).html("wires").appendTo(row); $("<td>",{class:"node-diff-property-cell-label"}).text("wires").appendTo(row);
localCell = $("<td>",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row); localCell = $("<td>",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row);
if (localNode) { if (localNode) {
if (!conflict) { if (!conflict) {
@ -917,7 +917,7 @@ RED.diff = (function() {
} }
row = $("<tr>").appendTo(nodePropertiesTableBody); row = $("<tr>").appendTo(nodePropertiesTableBody);
var propertyNameCell = $("<td>",{class:"node-diff-property-cell-label"}).html(d).appendTo(row); var propertyNameCell = $("<td>",{class:"node-diff-property-cell-label"}).text(d).appendTo(row);
localCell = $("<td>",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row); localCell = $("<td>",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row);
if (localNode) { if (localNode) {
if (!conflict) { if (!conflict) {

View File

@ -660,7 +660,7 @@ RED.editor = (function() {
return A.i-B.i; return A.i-B.i;
}) })
rows.forEach(function(r,i) { rows.forEach(function(r,i) {
r.r.find("label").html((i+1)+"."); r.r.find("label").text((i+1)+".");
r.r.appendTo(outputsDiv); r.r.appendTo(outputsDiv);
}) })
if (rows.length === 0) { if (rows.length === 0) {
@ -696,12 +696,12 @@ RED.editor = (function() {
function buildLabelRow(type, index, value, placeHolder) { function buildLabelRow(type, index, value, placeHolder) {
var result = $('<div>',{class:"node-label-form-row"}); var result = $('<div>',{class:"node-label-form-row"});
if (type === undefined) { if (type === undefined) {
$('<span>').html(RED._("editor.noDefaultLabel")).appendTo(result); $('<span>').text(RED._("editor.noDefaultLabel")).appendTo(result);
result.addClass("node-label-form-none"); result.addClass("node-label-form-none");
} else { } else {
result.addClass(""); result.addClass("");
var id = "node-label-form-"+type+"-"+index; var id = "node-label-form-"+type+"-"+index;
$('<label>',{for:id}).html((index+1)+".").appendTo(result); $('<label>',{for:id}).text((index+1)+".").appendTo(result);
var input = $('<input>',{type:"text",id:id, placeholder: placeHolder}).val(value).appendTo(result); var input = $('<input>',{type:"text",id:id, placeholder: placeHolder}).val(value).appendTo(result);
var clear = $('<button class="editor-button editor-button-small"><i class="fa fa-times"></i></button>').appendTo(result); var clear = $('<button class="editor-button editor-button-small"><i class="fa fa-times"></i></button>').appendTo(result);
clear.click(function(evt) { clear.click(function(evt) {
@ -1366,7 +1366,7 @@ RED.editor = (function() {
dialogForm.i18n(); dialogForm.i18n();
if (node_def.hasUsers !== false) { if (node_def.hasUsers !== false) {
$("#node-config-dialog-user-count").find("span").html(RED._("editor.nodesUse", {count:editing_config_node.users.length})).parent().show(); $("#node-config-dialog-user-count").find("span").text(RED._("editor.nodesUse", {count:editing_config_node.users.length})).parent().show();
} }
done(); done();
}); });
@ -1796,7 +1796,7 @@ RED.editor = (function() {
userCount++; userCount++;
} }
}); });
$("#subflow-dialog-user-count").html(RED._("subflow.subflowInstances", {count:userCount})).show(); $("#subflow-dialog-user-count").text(RED._("subflow.subflowInstances", {count:userCount})).show();
buildLabelForm(portLabels.content,subflow); buildLabelForm(portLabels.content,subflow);
validateIcon(subflow); validateIcon(subflow);
@ -1853,7 +1853,7 @@ RED.editor = (function() {
text: RED._("common.label.done"), text: RED._("common.label.done"),
class: "primary", class: "primary",
click: function() { click: function() {
$("#node-input-expression-help").html(""); $("#node-input-expression-help").text("");
onComplete(expressionEditor.getValue()); onComplete(expressionEditor.getValue());
RED.tray.close(); RED.tray.close();
} }

View File

@ -96,7 +96,7 @@ RED.notifications = (function() {
if (options.buttons) { if (options.buttons) {
var buttonSet = $('<div style="margin-top: 20px;" class="ui-dialog-buttonset"></div>').appendTo(n) var buttonSet = $('<div style="margin-top: 20px;" class="ui-dialog-buttonset"></div>').appendTo(n)
options.buttons.forEach(function(buttonDef) { options.buttons.forEach(function(buttonDef) {
var b = $('<button>').html(buttonDef.text).click(buttonDef.click).appendTo(buttonSet); var b = $('<button>').text(buttonDef.text).click(buttonDef.click).appendTo(buttonSet);
if (buttonDef.id) { if (buttonDef.id) {
b.attr('id',buttonDef.id); b.attr('id',buttonDef.id);
} }
@ -171,7 +171,7 @@ RED.notifications = (function() {
if (options.buttons) { if (options.buttons) {
var buttonSet = $('<div style="margin-top: 20px;" class="ui-dialog-buttonset"></div>').appendTo(nn) var buttonSet = $('<div style="margin-top: 20px;" class="ui-dialog-buttonset"></div>').appendTo(nn)
options.buttons.forEach(function(buttonDef) { options.buttons.forEach(function(buttonDef) {
var b = $('<button>').html(buttonDef.text).click(buttonDef.click).appendTo(buttonSet); var b = $('<button>').text(buttonDef.text).click(buttonDef.click).appendTo(buttonSet);
if (buttonDef.id) { if (buttonDef.id) {
b.attr('id',buttonDef.id); b.attr('id',buttonDef.id);
} }

View File

@ -247,14 +247,14 @@ RED.palette.editor = (function() {
nodeEntries[module].totalUseCount += inUseCount; nodeEntries[module].totalUseCount += inUseCount;
if (inUseCount > 0) { if (inUseCount > 0) {
setElements.enableButton.html(RED._('palette.editor.inuse')); setElements.enableButton.text(RED._('palette.editor.inuse'));
setElements.enableButton.addClass('disabled'); setElements.enableButton.addClass('disabled');
} else { } else {
setElements.enableButton.removeClass('disabled'); setElements.enableButton.removeClass('disabled');
if (set.enabled) { if (set.enabled) {
setElements.enableButton.html(RED._('palette.editor.disable')); setElements.enableButton.text(RED._('palette.editor.disable'));
} else { } else {
setElements.enableButton.html(RED._('palette.editor.enable')); setElements.enableButton.text(RED._('palette.editor.enable'));
} }
} }
setElements.setRow.toggleClass("palette-module-set-disabled",!set.enabled); setElements.setRow.toggleClass("palette-module-set-disabled",!set.enabled);
@ -268,10 +268,10 @@ RED.palette.editor = (function() {
} }
var nodeCount = (activeTypeCount === typeCount)?typeCount:activeTypeCount+" / "+typeCount; var nodeCount = (activeTypeCount === typeCount)?typeCount:activeTypeCount+" / "+typeCount;
nodeEntry.setCount.html(RED._('palette.editor.nodeCount',{count:typeCount,label:nodeCount})); nodeEntry.setCount.text(RED._('palette.editor.nodeCount',{count:typeCount,label:nodeCount}));
if (nodeEntries[module].totalUseCount > 0) { if (nodeEntries[module].totalUseCount > 0) {
nodeEntry.enableButton.html(RED._('palette.editor.inuse')); nodeEntry.enableButton.text(RED._('palette.editor.inuse'));
nodeEntry.enableButton.addClass('disabled'); nodeEntry.enableButton.addClass('disabled');
nodeEntry.removeButton.hide(); nodeEntry.removeButton.hide();
} else { } else {
@ -280,20 +280,20 @@ RED.palette.editor = (function() {
nodeEntry.removeButton.css('display', 'inline-block'); nodeEntry.removeButton.css('display', 'inline-block');
} }
if (activeTypeCount === 0) { if (activeTypeCount === 0) {
nodeEntry.enableButton.html(RED._('palette.editor.enableall')); nodeEntry.enableButton.text(RED._('palette.editor.enableall'));
} else { } else {
nodeEntry.enableButton.html(RED._('palette.editor.disableall')); nodeEntry.enableButton.text(RED._('palette.editor.disableall'));
} }
nodeEntry.container.toggleClass("disabled",(activeTypeCount === 0)); nodeEntry.container.toggleClass("disabled",(activeTypeCount === 0));
} }
} }
if (moduleInfo.pending_version) { if (moduleInfo.pending_version) {
nodeEntry.versionSpan.html(moduleInfo.version+' <i class="fa fa-long-arrow-right"></i> '+moduleInfo.pending_version).appendTo(nodeEntry.metaRow) nodeEntry.versionSpan.html(moduleInfo.version+' <i class="fa fa-long-arrow-right"></i> '+moduleInfo.pending_version).appendTo(nodeEntry.metaRow)
nodeEntry.updateButton.html(RED._('palette.editor.updated')).addClass('disabled').show(); nodeEntry.updateButton.text(RED._('palette.editor.updated')).addClass('disabled').show();
} else if (loadedIndex.hasOwnProperty(module)) { } else if (loadedIndex.hasOwnProperty(module)) {
if (semVerCompare(loadedIndex[module].version,moduleInfo.version) === 1) { if (semVerCompare(loadedIndex[module].version,moduleInfo.version) === 1) {
nodeEntry.updateButton.show(); nodeEntry.updateButton.show();
nodeEntry.updateButton.html(RED._('palette.editor.update',{version:loadedIndex[module].version})); nodeEntry.updateButton.text(RED._('palette.editor.update',{version:loadedIndex[module].version}));
} else { } else {
nodeEntry.updateButton.hide(); nodeEntry.updateButton.hide();
} }
@ -367,7 +367,7 @@ RED.palette.editor = (function() {
loadedIndex = {}; loadedIndex = {};
packageList.editableList('empty'); packageList.editableList('empty');
$(".palette-module-shade-status").html(RED._('palette.editor.loading')); $(".palette-module-shade-status").text(RED._('palette.editor.loading'));
var catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json']; var catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json'];
catalogueLoadStatus = []; catalogueLoadStatus = [];
catalogueLoadErrors = false; catalogueLoadErrors = false;
@ -473,7 +473,7 @@ RED.palette.editor = (function() {
if (filteredList[i].info.id === ns.module) { if (filteredList[i].info.id === ns.module) {
var installButton = filteredList[i].elements.installButton; var installButton = filteredList[i].elements.installButton;
installButton.addClass('disabled'); installButton.addClass('disabled');
installButton.html(RED._('palette.editor.installed')); installButton.text(RED._('palette.editor.installed'));
break; break;
} }
} }
@ -489,7 +489,7 @@ RED.palette.editor = (function() {
if (filteredList[i].info.id === ns.module) { if (filteredList[i].info.id === ns.module) {
var installButton = filteredList[i].elements.installButton; var installButton = filteredList[i].elements.installButton;
installButton.removeClass('disabled'); installButton.removeClass('disabled');
installButton.html(RED._('palette.editor.install')); installButton.text(RED._('palette.editor.install'));
break; break;
} }
} }
@ -595,9 +595,9 @@ RED.palette.editor = (function() {
if (entry) { if (entry) {
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container); var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
var titleRow = $('<div class="palette-module-meta palette-module-name"><i class="fa fa-cube"></i></div>').appendTo(headerRow); var titleRow = $('<div class="palette-module-meta palette-module-name"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
$('<span>').html(entry.name).appendTo(titleRow); $('<span>').text(entry.name).appendTo(titleRow);
var metaRow = $('<div class="palette-module-meta palette-module-version"><i class="fa fa-tag"></i></div>').appendTo(headerRow); var metaRow = $('<div class="palette-module-meta palette-module-version"><i class="fa fa-tag"></i></div>').appendTo(headerRow);
var versionSpan = $('<span>').html(entry.version).appendTo(metaRow); var versionSpan = $('<span>').text(entry.version).appendTo(metaRow);
var errorRow = $('<div class="palette-module-meta palette-module-errors"><i class="fa fa-warning"></i></div>').hide().appendTo(headerRow); var errorRow = $('<div class="palette-module-meta palette-module-errors"><i class="fa fa-warning"></i></div>').hide().appendTo(headerRow);
var errorList = $('<ul class="palette-module-error-list"></ul>').appendTo(errorRow); var errorList = $('<ul class="palette-module-error-list"></ul>').appendTo(errorRow);
@ -606,7 +606,7 @@ RED.palette.editor = (function() {
var setCount = $('<span>').appendTo(setButton); var setCount = $('<span>').appendTo(setButton);
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow); var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
var updateButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.update')).appendTo(buttonGroup); var updateButton = $('<a href="#" class="editor-button editor-button-small"></a>').text(RED._('palette.editor.update')).appendTo(buttonGroup);
updateButton.attr('id','up_'+Math.floor(Math.random()*1000000000)); updateButton.attr('id','up_'+Math.floor(Math.random()*1000000000));
updateButton.click(function(evt) { updateButton.click(function(evt) {
evt.preventDefault(); evt.preventDefault();
@ -617,7 +617,7 @@ RED.palette.editor = (function() {
}) })
var removeButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.remove')).appendTo(buttonGroup); var removeButton = $('<a href="#" class="editor-button editor-button-small"></a>').text(RED._('palette.editor.remove')).appendTo(buttonGroup);
removeButton.attr('id','up_'+Math.floor(Math.random()*1000000000)); removeButton.attr('id','up_'+Math.floor(Math.random()*1000000000));
removeButton.click(function(evt) { removeButton.click(function(evt) {
evt.preventDefault(); evt.preventDefault();
@ -626,7 +626,7 @@ RED.palette.editor = (function() {
if (!entry.local) { if (!entry.local) {
removeButton.hide(); removeButton.hide();
} }
var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.disableall')).appendTo(buttonGroup); var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').text(RED._('palette.editor.disableall')).appendTo(buttonGroup);
var contentRow = $('<div>',{class:"palette-module-content"}).appendTo(container); var contentRow = $('<div>',{class:"palette-module-content"}).appendTo(container);
var shade = $('<div class="palette-module-shade hide"><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(container); var shade = $('<div class="palette-module-shade hide"><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(container);
@ -666,7 +666,7 @@ RED.palette.editor = (function() {
set.types.forEach(function(t) { set.types.forEach(function(t) {
var typeDiv = $('<div>',{class:"palette-module-type"}).appendTo(setRow); var typeDiv = $('<div>',{class:"palette-module-type"}).appendTo(setRow);
typeSwatches[t] = $('<span>',{class:"palette-module-type-swatch"}).appendTo(typeDiv); typeSwatches[t] = $('<span>',{class:"palette-module-type-swatch"}).appendTo(typeDiv);
$('<span>',{class:"palette-module-type-node"}).html(t).appendTo(typeDiv); $('<span>',{class:"palette-module-type-node"}).text(t).appendTo(typeDiv);
}) })
var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').appendTo(buttonGroup); var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').appendTo(buttonGroup);
enableButton.click(function(evt) { enableButton.click(function(evt) {
@ -705,7 +705,7 @@ RED.palette.editor = (function() {
}) })
refreshNodeModule(entry.name); refreshNodeModule(entry.name);
} else { } else {
$('<div>',{class:"red-ui-search-empty"}).html(RED._('search.empty')).appendTo(container); $('<div>',{class:"red-ui-search-empty"}).text(RED._('search.empty')).appendTo(container);
} }
} }
}); });
@ -745,7 +745,7 @@ RED.palette.editor = (function() {
}); });
$('<span>').html(RED._("palette.editor.sort")+' ').appendTo(toolBar); $('<span>').text(RED._("palette.editor.sort")+' ').appendTo(toolBar);
var sortGroup = $('<span class="button-group"></span>').appendTo(toolBar); var sortGroup = $('<span class="button-group"></span>').appendTo(toolBar);
var sortAZ = $('<a href="#" class="sidebar-header-button-toggle selected" data-i18n="palette.editor.sortAZ"></a>').appendTo(sortGroup); var sortAZ = $('<a href="#" class="sidebar-header-button-toggle selected" data-i18n="palette.editor.sortAZ"></a>').appendTo(sortGroup);
var sortRecent = $('<a href="#" class="sidebar-header-button-toggle" data-i18n="palette.editor.sortRecent"></a>').appendTo(sortGroup); var sortRecent = $('<a href="#" class="sidebar-header-button-toggle" data-i18n="palette.editor.sortRecent"></a>').appendTo(sortGroup);
@ -787,13 +787,13 @@ RED.palette.editor = (function() {
scrollOnAdd: false, scrollOnAdd: false,
addItem: function(container,i,object) { addItem: function(container,i,object) {
if (object.count) { if (object.count) {
$('<div>',{class:"red-ui-search-empty"}).html(RED._('palette.editor.moduleCount',{count:object.count})).appendTo(container); $('<div>',{class:"red-ui-search-empty"}).text(RED._('palette.editor.moduleCount',{count:object.count})).appendTo(container);
return return
} }
if (object.more) { if (object.more) {
container.addClass('palette-module-more'); container.addClass('palette-module-more');
var moreRow = $('<div>',{class:"palette-module-header palette-module"}).appendTo(container); var moreRow = $('<div>',{class:"palette-module-header palette-module"}).appendTo(container);
var moreLink = $('<a href="#"></a>').html(RED._('palette.editor.more',{count:object.more})).appendTo(moreRow); var moreLink = $('<a href="#"></a>').text(RED._('palette.editor.more',{count:object.more})).appendTo(moreRow);
moreLink.click(function(e) { moreLink.click(function(e) {
e.preventDefault(); e.preventDefault();
packageList.editableList('removeItem',object); packageList.editableList('removeItem',object);
@ -810,17 +810,17 @@ RED.palette.editor = (function() {
var entry = object.info; var entry = object.info;
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container); var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
var titleRow = $('<div class="palette-module-meta"><i class="fa fa-cube"></i></div>').appendTo(headerRow); var titleRow = $('<div class="palette-module-meta"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
$('<span>',{class:"palette-module-name"}).html(entry.name||entry.id).appendTo(titleRow); $('<span>',{class:"palette-module-name"}).text(entry.name||entry.id).appendTo(titleRow);
$('<a target="_blank" class="palette-module-link"><i class="fa fa-external-link"></i></a>').attr('href',entry.url).appendTo(titleRow); $('<a target="_blank" class="palette-module-link"><i class="fa fa-external-link"></i></a>').attr('href',entry.url).appendTo(titleRow);
var descRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow); var descRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow);
$('<div>',{class:"palette-module-description"}).html(entry.description).appendTo(descRow); $('<div>',{class:"palette-module-description"}).text(entry.description).appendTo(descRow);
var metaRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow); var metaRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow);
$('<span class="palette-module-version"><i class="fa fa-tag"></i> '+entry.version+'</span>').appendTo(metaRow); $('<span class="palette-module-version"><i class="fa fa-tag"></i> '+entry.version+'</span>').appendTo(metaRow);
$('<span class="palette-module-updated"><i class="fa fa-calendar"></i> '+formatUpdatedAt(entry.updated_at)+'</span>').appendTo(metaRow); $('<span class="palette-module-updated"><i class="fa fa-calendar"></i> '+formatUpdatedAt(entry.updated_at)+'</span>').appendTo(metaRow);
var buttonRow = $('<div>',{class:"palette-module-meta"}).appendTo(headerRow); var buttonRow = $('<div>',{class:"palette-module-meta"}).appendTo(headerRow);
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow); var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
var installButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.install')).appendTo(buttonGroup); var installButton = $('<a href="#" class="editor-button editor-button-small"></a>').text(RED._('palette.editor.install')).appendTo(buttonGroup);
installButton.click(function(e) { installButton.click(function(e) {
e.preventDefault(); e.preventDefault();
if (!$(this).hasClass('disabled')) { if (!$(this).hasClass('disabled')) {
@ -829,14 +829,14 @@ RED.palette.editor = (function() {
}) })
if (nodeEntries.hasOwnProperty(entry.id)) { if (nodeEntries.hasOwnProperty(entry.id)) {
installButton.addClass('disabled'); installButton.addClass('disabled');
installButton.html(RED._('palette.editor.installed')); installButton.text(RED._('palette.editor.installed'));
} }
object.elements = { object.elements = {
installButton:installButton installButton:installButton
} }
} else { } else {
$('<div>',{class:"red-ui-search-empty"}).html(RED._('search.empty')).appendTo(container); $('<div>',{class:"red-ui-search-empty"}).text(RED._('search.empty')).appendTo(container);
} }
} }
}); });

View File

@ -444,9 +444,9 @@ RED.projects.settings = (function() {
} }
var icon = $('<i class="fa '+iconClass+'"></i>').appendTo(titleRow); var icon = $('<i class="fa '+iconClass+'"></i>').appendTo(titleRow);
entry.icon = icon; entry.icon = icon;
$('<span>').html(entry.id).appendTo(titleRow); $('<span>').text(entry.id).appendTo(titleRow);
var metaRow = $('<div class="palette-module-meta palette-module-version"><i class="fa fa-tag"></i></div>').appendTo(headerRow); var metaRow = $('<div class="palette-module-meta palette-module-version"><i class="fa fa-tag"></i></div>').appendTo(headerRow);
var versionSpan = $('<span>').html(entry.version).appendTo(metaRow); var versionSpan = $('<span>').text(entry.version).appendTo(metaRow);
metaRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow); metaRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow);
var buttons = $('<div class="palette-module-button-group"></div>').appendTo(metaRow); var buttons = $('<div class="palette-module-button-group"></div>').appendTo(metaRow);
if (RED.user.hasPermission("projects.write")) { if (RED.user.hasPermission("projects.write")) {

View File

@ -174,7 +174,7 @@ RED.search = (function() {
addItem: function(container,i,object) { addItem: function(container,i,object) {
var node = object.node; var node = object.node;
if (node === undefined) { if (node === undefined) {
$('<div>',{class:"red-ui-search-empty"}).html(RED._('search.empty')).appendTo(container); $('<div>',{class:"red-ui-search-empty"}).text(RED._('search.empty')).appendTo(container);
} else { } else {
var def = node._def; var def = node._def;
@ -200,12 +200,12 @@ RED.search = (function() {
} else { } else {
workspace = "flow:"+workspace.label; workspace = "flow:"+workspace.label;
} }
$('<div>',{class:"red-ui-search-result-node-flow"}).html(workspace).appendTo(contentDiv); $('<div>',{class:"red-ui-search-result-node-flow"}).text(workspace).appendTo(contentDiv);
} }
$('<div>',{class:"red-ui-search-result-node-label"}).html(object.label || node.id).appendTo(contentDiv); $('<div>',{class:"red-ui-search-result-node-label"}).text(object.label || node.id).appendTo(contentDiv);
$('<div>',{class:"red-ui-search-result-node-type"}).html(node.type).appendTo(contentDiv); $('<div>',{class:"red-ui-search-result-node-type"}).text(node.type).appendTo(contentDiv);
$('<div>',{class:"red-ui-search-result-node-id"}).html(node.id).appendTo(contentDiv); $('<div>',{class:"red-ui-search-result-node-id"}).text(node.id).appendTo(contentDiv);
div.click(function(evt) { div.click(function(evt) {
evt.preventDefault(); evt.preventDefault();

View File

@ -139,7 +139,7 @@ RED.subflow = (function() {
RED.view.select(); RED.view.select();
RED.nodes.dirty(true); RED.nodes.dirty(true);
RED.view.redraw(); RED.view.redraw();
$("#workspace-subflow-output .spinner-value").html(subflow.out.length); $("#workspace-subflow-output .spinner-value").text(subflow.out.length);
} }
function removeSubflowOutput(removedSubflowOutputs) { function removeSubflowOutput(removedSubflowOutputs) {
@ -216,7 +216,7 @@ RED.subflow = (function() {
$("#workspace-subflow-input-add").toggleClass("active", activeSubflow.in.length !== 0); $("#workspace-subflow-input-add").toggleClass("active", activeSubflow.in.length !== 0);
$("#workspace-subflow-input-remove").toggleClass("active",activeSubflow.in.length === 0); $("#workspace-subflow-input-remove").toggleClass("active",activeSubflow.in.length === 0);
$("#workspace-subflow-output .spinner-value").html(activeSubflow.out.length); $("#workspace-subflow-output .spinner-value").text(activeSubflow.out.length);
} }
} }

View File

@ -167,7 +167,7 @@ RED.sidebar.info = (function() {
$(propRow.children()[1]).text(node.label||node.name||""); $(propRow.children()[1]).text(node.label||node.name||"");
if (node.type === "tab") { if (node.type === "tab") {
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.status")+'</td><td></td></tr>').appendTo(tableBody); propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.status")+'</td><td></td></tr>').appendTo(tableBody);
$(propRow.children()[1]).html((!!!node.disabled)?RED._("sidebar.info.enabled"):RED._("sidebar.info.disabled")) $(propRow.children()[1]).text((!!!node.disabled)?RED._("sidebar.info.enabled"):RED._("sidebar.info.disabled"))
} }
} else { } else {
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.node")+"</td><td></td></tr>").appendTo(tableBody); propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.node")+"</td><td></td></tr>").appendTo(tableBody);
@ -175,10 +175,12 @@ RED.sidebar.info = (function() {
if (node.type !== "subflow" && node.name) { if (node.type !== "subflow" && node.name) {
$('<tr class="node-info-node-row"><td>'+RED._("common.label.name")+'</td><td><span class="bidiAware" dir="'+RED.text.bidi.resolveBaseTextDir(node.name)+'">'+node.name+'</span></td></tr>').appendTo(tableBody); propRow = $('<tr class="node-info-node-row"><td>'+RED._("common.label.name")+'</td><td></td></tr>').appendTo(tableBody);
$('<span class="bidiAware" dir="'+RED.text.bidi.resolveBaseTextDir(node.name)+'"></span>').text(node.name).appendTo(propRow.children()[1]);
} }
if (!m) { if (!m) {
$('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.type")+"</td><td>"+node.type+"</td></tr>").appendTo(tableBody); propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.type")+"</td><td></td></tr>").appendTo(tableBody);
$(propRow.children()[1]).text(node.type);
} }
if (!m && node.type != "subflow" && node.type != "comment") { if (!m && node.type != "subflow" && node.type != "comment") {
@ -206,7 +208,7 @@ RED.sidebar.info = (function() {
nodeDiv.css({'backgroundColor':colour, "cursor":"pointer"}); nodeDiv.css({'backgroundColor':colour, "cursor":"pointer"});
var iconContainer = $('<div/>',{class:"palette_icon_container"}).appendTo(nodeDiv); var iconContainer = $('<div/>',{class:"palette_icon_container"}).appendTo(nodeDiv);
$('<div/>',{class:"palette_icon",style:"background-image: url("+icon_url+")"}).appendTo(iconContainer); $('<div/>',{class:"palette_icon",style:"background-image: url("+icon_url+")"}).appendTo(iconContainer);
var nodeContainer = $('<span></span>').css({"verticalAlign":"top","marginLeft":"6px"}).html(configLabel).appendTo(container); var nodeContainer = $('<span></span>').css({"verticalAlign":"top","marginLeft":"6px"}).text(configLabel).appendTo(container);
nodeDiv.on('dblclick',function() { nodeDiv.on('dblclick',function() {
RED.editor.editConfig("", configNode.type, configNode.id); RED.editor.editConfig("", configNode.type, configNode.id);
@ -236,19 +238,19 @@ RED.sidebar.info = (function() {
var infoText = ""; var infoText = "";
if (!subflowNode && node.type !== "comment" && node.type !== "tab") { if (!subflowNode && node.type !== "comment" && node.type !== "tab") {
infoSection.title.html(RED._("sidebar.info.nodeHelp")); infoSection.title.text(RED._("sidebar.info.nodeHelp"));
var helpText = $("script[data-help-name='"+node.type+"']").html()||('<span class="node-info-none">'+RED._("sidebar.info.none")+'</span>'); var helpText = $("script[data-help-name='"+node.type+"']").html()||('<span class="node-info-none">'+RED._("sidebar.info.none")+'</span>');
infoText = helpText; infoText = helpText;
} else if (node.type === "tab") { } else if (node.type === "tab") {
infoSection.title.html(RED._("sidebar.info.flowDesc")); infoSection.title.text(RED._("sidebar.info.flowDesc"));
infoText = marked(node.info||"")||('<span class="node-info-none">'+RED._("sidebar.info.none")+'</span>'); infoText = marked(node.info||"")||('<span class="node-info-none">'+RED._("sidebar.info.none")+'</span>');
} }
if (subflowNode) { if (subflowNode) {
infoText = infoText + (marked(subflowNode.info||"")||('<span class="node-info-none">'+RED._("sidebar.info.none")+'</span>')); infoText = infoText + (marked(subflowNode.info||"")||('<span class="node-info-none">'+RED._("sidebar.info.none")+'</span>'));
infoSection.title.html(RED._("sidebar.info.subflowDesc")); infoSection.title.text(RED._("sidebar.info.subflowDesc"));
} else if (node._def && node._def.info) { } else if (node._def && node._def.info) {
infoSection.title.html(RED._("sidebar.info.nodeHelp")); infoSection.title.text(RED._("sidebar.info.nodeHelp"));
var info = node._def.info; var info = node._def.info;
var textInfo = (typeof info === "function" ? info.call(node) : info); var textInfo = (typeof info === "function" ? info.call(node) : info);
// TODO: help // TODO: help

View File

@ -52,7 +52,7 @@ RED.tray = (function() {
b.attr('id',button.id); b.attr('id',button.id);
} }
if (button.text) { if (button.text) {
b.html(button.text); b.text(button.text);
} }
if (button.click) { if (button.click) {
b.click((function(action) { b.click((function(action) {

View File

@ -147,7 +147,7 @@ RED.typeSearch = (function() {
var label = object.label; var label = object.label;
object.index += "|"+label.toLowerCase(); object.index += "|"+label.toLowerCase();
$('<div>',{class:"red-ui-search-result-node-label"}).html(label).appendTo(contentDiv); $('<div>',{class:"red-ui-search-result-node-label"}).text(label).appendTo(contentDiv);
div.click(function(evt) { div.click(function(evt) {
evt.preventDefault(); evt.preventDefault();

View File

@ -26,14 +26,14 @@ RED.utils = (function() {
function buildMessageSummaryValue(value) { function buildMessageSummaryValue(value) {
var result; var result;
if (Array.isArray(value)) { if (Array.isArray(value)) {
result = $('<span class="debug-message-object-value debug-message-type-meta"></span>').html('array['+value.length+']'); result = $('<span class="debug-message-object-value debug-message-type-meta"></span>').text('array['+value.length+']');
} else if (value === null) { } else if (value === null) {
result = $('<span class="debug-message-object-value debug-message-type-null">null</span>'); result = $('<span class="debug-message-object-value debug-message-type-null">null</span>');
} else if (typeof value === 'object') { } else if (typeof value === 'object') {
if (value.hasOwnProperty('type') && value.type === 'Buffer' && value.hasOwnProperty('data')) { if (value.hasOwnProperty('type') && value.type === 'Buffer' && value.hasOwnProperty('data')) {
result = $('<span class="debug-message-object-value debug-message-type-meta"></span>').html('buffer['+value.length+']'); result = $('<span class="debug-message-object-value debug-message-type-meta"></span>').text('buffer['+value.length+']');
} else if (value.hasOwnProperty('type') && value.type === 'array' && value.hasOwnProperty('data')) { } else if (value.hasOwnProperty('type') && value.type === 'array' && value.hasOwnProperty('data')) {
result = $('<span class="debug-message-object-value debug-message-type-meta"></span>').html('array['+value.length+']'); result = $('<span class="debug-message-object-value debug-message-type-meta"></span>').text('array['+value.length+']');
} else { } else {
result = $('<span class="debug-message-object-value debug-message-type-meta">object</span>'); result = $('<span class="debug-message-object-value debug-message-type-meta">object</span>');
} }
@ -304,7 +304,7 @@ RED.utils = (function() {
element.addClass('collapsed'); element.addClass('collapsed');
$('<i class="fa fa-caret-right debug-message-object-handle"></i> ').prependTo(header); $('<i class="fa fa-caret-right debug-message-object-handle"></i> ').prependTo(header);
makeExpandable(header, function() { makeExpandable(header, function() {
$('<span class="debug-message-type-meta debug-message-object-type-header"></span>').html(typeHint||'string').appendTo(header); $('<span class="debug-message-type-meta debug-message-object-type-header"></span>').text(typeHint||'string').appendTo(header);
var row = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(element); var row = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(element);
$('<pre class="debug-message-type-string"></pre>').text(obj).appendTo(row); $('<pre class="debug-message-type-string"></pre>').text(obj).appendTo(row);
},function(state) {if (ontoggle) { ontoggle(path,state);}}, checkExpanded(strippedKey,expandPaths)); },function(state) {if (ontoggle) { ontoggle(path,state);}}, checkExpanded(strippedKey,expandPaths));
@ -358,7 +358,7 @@ RED.utils = (function() {
element.addClass('debug-message-buffer-raw'); element.addClass('debug-message-buffer-raw');
} }
if (key) { if (key) {
headerHead = $('<span class="debug-message-type-meta"></span>').html(typeHint||(type+'['+originalLength+']')).appendTo(entryObj); headerHead = $('<span class="debug-message-type-meta"></span>').text(typeHint||(type+'['+originalLength+']')).appendTo(entryObj);
} else { } else {
headerHead = $('<span class="debug-message-object-header"></span>').appendTo(entryObj); headerHead = $('<span class="debug-message-object-header"></span>').appendTo(entryObj);
$('<span>[ </span>').appendTo(headerHead); $('<span>[ </span>').appendTo(headerHead);
@ -381,7 +381,7 @@ RED.utils = (function() {
makeExpandable(header,function() { makeExpandable(header,function() {
if (!key) { if (!key) {
headerHead = $('<span class="debug-message-type-meta debug-message-object-type-header"></span>').html(typeHint||(type+'['+originalLength+']')).appendTo(header); headerHead = $('<span class="debug-message-type-meta debug-message-object-type-header"></span>').text(typeHint||(type+'['+originalLength+']')).appendTo(header);
} }
if (type === 'buffer') { if (type === 'buffer') {
var stringRow = $('<div class="debug-message-string-rows"></div>').appendTo(element); var stringRow = $('<div class="debug-message-string-rows"></div>').appendTo(element);
@ -394,7 +394,7 @@ RED.utils = (function() {
} }
$('<pre class="debug-message-type-string"></pre>').text(stringEncoding).appendTo(sr); $('<pre class="debug-message-type-string"></pre>').text(stringEncoding).appendTo(sr);
var bufferOpts = $('<span class="debug-message-buffer-opts"></span>').appendTo(headerHead); var bufferOpts = $('<span class="debug-message-buffer-opts"></span>').appendTo(headerHead);
var switchFormat = $('<a href="#"></a>').addClass('selected').html('raw').appendTo(bufferOpts).click(function(e) { var switchFormat = $('<a href="#"></a>').addClass('selected').text('raw').appendTo(bufferOpts).click(function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
formatBuffer(element,$(this),sourceId,path,true); formatBuffer(element,$(this),sourceId,path,true);
@ -471,7 +471,7 @@ RED.utils = (function() {
$('<i class="fa fa-caret-right debug-message-object-handle"></i> ').prependTo(header); $('<i class="fa fa-caret-right debug-message-object-handle"></i> ').prependTo(header);
makeExpandable(header, function() { makeExpandable(header, function() {
if (!key) { if (!key) {
$('<span class="debug-message-type-meta debug-message-object-type-header"></span>').html('object').appendTo(header); $('<span class="debug-message-type-meta debug-message-object-type-header"></span>').text('object').appendTo(header);
} }
for (i=0;i<keys.length;i++) { for (i=0;i<keys.length;i++) {
var row = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(element); var row = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(element);
@ -507,7 +507,7 @@ RED.utils = (function() {
checkExpanded(strippedKey,expandPaths)); checkExpanded(strippedKey,expandPaths));
} }
if (key) { if (key) {
$('<span class="debug-message-type-meta"></span>').html('object').appendTo(entryObj); $('<span class="debug-message-type-meta"></span>').text('object').appendTo(entryObj);
} else { } else {
headerHead = $('<span class="debug-message-object-header"></span>').appendTo(entryObj); headerHead = $('<span class="debug-message-object-header"></span>').appendTo(entryObj);
$('<span>{ </span>').appendTo(headerHead); $('<span>{ </span>').appendTo(headerHead);

View File

@ -172,12 +172,12 @@ RED.workspaces = (function() {
i.addClass('fa-toggle-on'); i.addClass('fa-toggle-on');
i.removeClass('fa-toggle-off'); i.removeClass('fa-toggle-off');
$("#node-input-disabled").prop("checked",false); $("#node-input-disabled").prop("checked",false);
$("#node-input-disabled-label").html(RED._("editor:workspace.enabled")); $("#node-input-disabled-label").text(RED._("editor:workspace.enabled"));
} else { } else {
i.addClass('fa-toggle-off'); i.addClass('fa-toggle-off');
i.removeClass('fa-toggle-on'); i.removeClass('fa-toggle-on');
$("#node-input-disabled").prop("checked",true); $("#node-input-disabled").prop("checked",true);
$("#node-input-disabled-label").html(RED._("editor:workspace.disabled")); $("#node-input-disabled-label").text(RED._("editor:workspace.disabled"));
} }
}) })
@ -185,13 +185,13 @@ RED.workspaces = (function() {
$("#node-input-disabled").prop("checked",workspace.disabled); $("#node-input-disabled").prop("checked",workspace.disabled);
if (workspace.disabled) { if (workspace.disabled) {
dialogForm.find("#node-input-disabled-btn i").removeClass('fa-toggle-on').addClass('fa-toggle-off'); dialogForm.find("#node-input-disabled-btn i").removeClass('fa-toggle-on').addClass('fa-toggle-off');
$("#node-input-disabled-label").html(RED._("editor:workspace.disabled")); $("#node-input-disabled-label").text(RED._("editor:workspace.disabled"));
} else { } else {
$("#node-input-disabled-label").html(RED._("editor:workspace.enabled")); $("#node-input-disabled-label").text(RED._("editor:workspace.enabled"));
} }
} else { } else {
workspace.disabled = false; workspace.disabled = false;
$("#node-input-disabled-label").html(RED._("editor:workspace.enabled")); $("#node-input-disabled-label").text(RED._("editor:workspace.enabled"));
} }
$('<input type="text" style="display: none;" />').prependTo(dialogForm); $('<input type="text" style="display: none;" />').prependTo(dialogForm);