- Refactoring: Avoid redundant creation of text node for strings when passing to `append`
parent
332a562876
commit
92f8a5be57
|
@ -69,19 +69,19 @@ describe('draw.Drawing', function () {
|
|||
const setupSVGWith3Layers = function (svgElem) {
|
||||
const layer1 = document.createElementNS(NS.SVG, 'g');
|
||||
const layer1Title = document.createElementNS(NS.SVG, 'title');
|
||||
layer1Title.append(document.createTextNode(LAYER1));
|
||||
layer1Title.append(LAYER1);
|
||||
layer1.append(layer1Title);
|
||||
svgElem.append(layer1);
|
||||
|
||||
const layer2 = document.createElementNS(NS.SVG, 'g');
|
||||
const layer2Title = document.createElementNS(NS.SVG, 'title');
|
||||
layer2Title.append(document.createTextNode(LAYER2));
|
||||
layer2Title.append(LAYER2);
|
||||
layer2.append(layer2Title);
|
||||
svgElem.append(layer2);
|
||||
|
||||
const layer3 = document.createElementNS(NS.SVG, 'g');
|
||||
const layer3Title = document.createElementNS(NS.SVG, 'title');
|
||||
layer3Title.append(document.createTextNode(LAYER3));
|
||||
layer3Title.append(LAYER3);
|
||||
layer3.append(layer3Title);
|
||||
svgElem.append(layer3);
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ describe('recalculate', function () {
|
|||
tspan.setAttribute('x', '200');
|
||||
tspan.setAttribute('y', '150');
|
||||
|
||||
const theText = document.createTextNode('Foo bar');
|
||||
const theText = 'Foo bar';
|
||||
tspan.append(theText);
|
||||
elem.append(tspan);
|
||||
svg.append(elem);
|
||||
|
|
|
@ -232,7 +232,7 @@ export default {
|
|||
$(this).html(
|
||||
$('<span>').append(
|
||||
$('<img>').attr('src', curMeta.preview_url),
|
||||
document.createTextNode(title)
|
||||
title
|
||||
)
|
||||
);
|
||||
} else {
|
||||
|
@ -254,7 +254,7 @@ export default {
|
|||
if (curMeta && curMeta.preview_url) {
|
||||
entry = $('<span>').append(
|
||||
$('<img>').attr('src', curMeta.preview_url),
|
||||
document.createTextNode(title)
|
||||
title
|
||||
);
|
||||
} else {
|
||||
entry = $('<img>').attr('src', response);
|
||||
|
|
Loading…
Reference in New Issue