From 03c32d2f6aee2ef296f6169f691feffece012650 Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Mon, 28 Sep 2020 15:36:01 -0400 Subject: [PATCH] Return empty string instead of empty html element for empty text --- modules/core/localizer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/core/localizer.js b/modules/core/localizer.js index b68b24338..e5df34f1a 100644 --- a/modules/core/localizer.js +++ b/modules/core/localizer.js @@ -322,7 +322,8 @@ export function coreLocalizer() { // Returns the localized text wrapped in an HTML element encoding the locale info localizer.t.html = function(stringId, replacements, locale) { const info = localizer.tInfo(stringId, replacements, locale); - return localizer.htmlForLocalizedText(info.text, info.locale); + // text may be empty or undefined if `replacements.default` is + return info.text ? localizer.htmlForLocalizedText(info.text, info.locale) : ''; }; localizer.htmlForLocalizedText = function(text, localeCode) {