From 2c58a0ac71f7f94db6d7019219cc5d89f1019f24 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 27 Jul 2023 18:48:01 +0100 Subject: [PATCH] Refactor missing transclusion target --- core/modules/widgets/transclude.js | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/core/modules/widgets/transclude.js b/core/modules/widgets/transclude.js index ad9f26f8b..12d775de7 100755 --- a/core/modules/widgets/transclude.js +++ b/core/modules/widgets/transclude.js @@ -269,22 +269,12 @@ TranscludeWidget.prototype.getTransclusionTarget = function(parseAsInline) { }); } // Return the parse tree - if(parser) { - return { - parseTreeNodes: parser.tree, - parseAsInline: parseAsInline, - text: parser.source, - type: parser.type - }; - } else { - // If there's no parse tree then return the missing slot value - return { - parseTreeNodes: (this.slotFillParseTrees["ts-missing"] || []), - parseAsInline: parseAsInline, - text: null, - type: null - }; - } + return { + parseTreeNodes: parser ? parser.tree : (this.slotFillParseTrees["ts-missing"] || []), + parseAsInline: parseAsInline, + text: parser && parser.source, + type: parser && parser.type + }; }; /*