mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-26 17:06:51 +00:00
Empty or missing type on genesis widget should not render an element/widget
Fixes #7153
This commit is contained in:
parent
bf8e1ca5b0
commit
42a408146d
@ -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),
|
||||
|
@ -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>
|
||||
|
||||
<$genesis $type="">Mouse</$genesis>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Mouse</p><p>Mouse</p>
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user