From 17f1220718f0e736723108042fc00cd5cb90070d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 5 Apr 2023 15:41:38 -0300 Subject: html: standard blank() function For now this just returns an empty array, but if we need to make changes later, it won't require editing all instances of blank content! --- src/content/dependencies/generateAlbumTrackList.js | 2 +- src/misc-templates.js | 2 +- src/util/html.js | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/content/dependencies/generateAlbumTrackList.js b/src/content/dependencies/generateAlbumTrackList.js index a2b03049..f2f2279d 100644 --- a/src/content/dependencies/generateAlbumTrackList.js +++ b/src/content/dependencies/generateAlbumTrackList.js @@ -121,6 +121,6 @@ export default { return html.tag(listTag, relations.itemsByTrack); } - return []; + return html.blank(); } }; diff --git a/src/misc-templates.js b/src/misc-templates.js index 651b6bce..710dbcc3 100644 --- a/src/misc-templates.js +++ b/src/misc-templates.js @@ -53,7 +53,7 @@ function unbound_generateChronologyLinks(currentThing, { const contributions = currentThing[contribKey]; if (empty(contributions)) { - return []; + return html.blank(); } if (contributions.length > 8) { diff --git a/src/util/html.js b/src/util/html.js index a7b44ec6..be267003 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -38,6 +38,10 @@ export const joinChildren = Symbol(); // or when there are multiple children. export const noEdgeWhitespace = Symbol(); +export function blank() { + return []; +} + export function tag(tagName, ...args) { let content; let attributes; @@ -408,7 +412,7 @@ export class Template { : item.valueOf())); return new Tag(null, null, contents).valueOf(); } else { - return []; + return blank(); } } -- cgit 1.3.0-6-gf8a5