From 86d9899aa181907102b11265c74fc4aae63a7afc Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 12 Apr 2024 15:13:44 -0300 Subject: content: transformContent: don't bother stringifying real attributes The main benefit of stringifying attributes like this is escaping, which isn't needed here, since we know all the values that might be going into it. --- src/content/dependencies/transformContent.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js index 42790e7c..f1ea957e 100644 --- a/src/content/dependencies/transformContent.js +++ b/src/content/dependencies/transformContent.js @@ -448,13 +448,10 @@ export default { return getTextNodeContents(node, index); } - const attributes = html.attributes({ - class: 'INSERT-NON-TEXT', - 'data-type': node.type, - }); + let attributes = `class="INSERT-NON-TEXT" data-type="${node.type}"`; - if (node.type === 'processed-image') { - attributes.set('data-inline', node.inline); + if (node.type === 'processed-image' && node.inline) { + attributes += ` data-inline`; } return `${index}`; -- cgit 1.3.0-6-gf8a5