diff --git a/core/modules/widgets/genesis.js b/core/modules/widgets/genesis.js index 51544361e..6d30f3c36 100644 --- a/core/modules/widgets/genesis.js +++ b/core/modules/widgets/genesis.js @@ -42,10 +42,15 @@ Compute the internal state of the widget GenesisWidget.prototype.execute = function() { var self = this; // Collect attributes - this.genesisType = this.getAttribute("$type","element"); + this.genesisType = this.getAttribute("$type"); this.genesisRemappable = this.getAttribute("$remappable","yes") === "yes"; this.genesisNames = this.getAttribute("$names",""); this.genesisValues = this.getAttribute("$values",""); + // Do not create a child widget if the $type attribute is missing or blank + if(!this.genesisType) { + this.makeChildWidgets(this.parseTreeNode.children); + return; + } // Construct parse tree var isElementWidget = this.genesisType.charAt(0) !== "$", nodeType = isElementWidget ? "element" : this.genesisType.substr(1), diff --git a/editions/test/tiddlers/tests/data/genesis-widget/EmptyType.tid b/editions/test/tiddlers/tests/data/genesis-widget/EmptyType.tid new file mode 100644 index 000000000..59768aa0c --- /dev/null +++ b/editions/test/tiddlers/tests/data/genesis-widget/EmptyType.tid @@ -0,0 +1,14 @@ +title: Genesis/EmptyType +description: Using an empty type attribute with the genesis widget +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +<$genesis>Mouse + +<$genesis $type="">Mouse ++ +title: ExpectedResult + +

Mouse

Mouse

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid b/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid index a9d2cf713..4d6ca229b 100644 --- a/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/GenesisWidget.tid @@ -1,6 +1,6 @@ caption: genesis created: 20221101100729587 -modified: 20221101100729587 +modified: 20221230213912929 tags: Widgets title: GenesisWidget type: text/vnd.tiddlywiki @@ -21,6 +21,8 @@ The content of the <<.wlink GenesisWidget>> widget is used as the content of the |//{attributes starting with $$}// |Attributes starting with two dollar signs are appplied as attributes to the output widget, but with the attribute name changed to use a single dollar sign | |//{attributes not starting with $}// |Any other attributes that do not start with a dollar are applied as attributes to the output widget | +<<.from-version "5.2.6">> If the `$type` attribute is missing or blank, the <<.wlink GenesisWidget>> widget does not render an intrinsic element, instead just rendering its children. + Note that attributes explicitly specified take precedence over attributes with the same name specified in the `$names` filter. ! Examples