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

Avoid innerHtml

This commit is contained in:
bartbutenaers 2021-02-22 21:45:12 +01:00 committed by GitHub
parent ae7a3981c0
commit 0fef2ab509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,18 +94,19 @@
} }
buttons.forEach(function(button) { buttons.forEach(function(button) {
var innerHtml = ""; var text = "";
var titleAttribute=""; var titleAttribute="";
if (button.icon) { if (button.icon) {
innerHtml = '<i class="'+button.icon+'"></i> '; text = '<i class="'+button.icon+'"></i> ';
} }
if (button.label) { if (button.label) {
innerHtml += button.label; text += button.label;
} }
if (button.title) { if (button.title) {
titleAttribute = 'title="'+button.title+'"'; titleAttribute = 'title="'+button.title+'"';
} }
$('<a href="#" class="red-ui-button red-ui-button-small red-ui-editableList-addButton" style="margin-top: 4px; margin-right: 5px;" '+titleAttribute+'>'+innerHtml+'</a>') $('<a href="#" class="red-ui-button red-ui-button-small red-ui-editableList-addButton" style="margin-top: 4px; margin-right: 5px;" '+titleAttribute+'></a>')
.text(text)
.appendTo(that.topContainer) .appendTo(that.topContainer)
.on("click", function(evt) { .on("click", function(evt) {
evt.preventDefault(); evt.preventDefault();