mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-14 03:10:26 +00:00
Fix genesis widget so that explicit attributes take precedence
Fixes #8701
This commit is contained in:
parent
6787a174b1
commit
f565b5b55d
@ -65,6 +65,16 @@ GenesisWidget.prototype.execute = function() {
|
||||
children: this.parseTreeNode.children || [],
|
||||
isNotRemappable: !this.genesisRemappable
|
||||
}];
|
||||
// Apply attributes in $names/$values
|
||||
this.attributeNames = [];
|
||||
this.attributeValues = [];
|
||||
if(this.genesisNames && this.genesisValues) {
|
||||
this.attributeNames = this.wiki.filterTiddlers(self.genesisNames,this);
|
||||
this.attributeValues = this.wiki.filterTiddlers(self.genesisValues,this);
|
||||
$tw.utils.each(this.attributeNames,function(varname,index) {
|
||||
$tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],varname,self.attributeValues[index] || "");
|
||||
});
|
||||
}
|
||||
// Apply explicit attributes
|
||||
$tw.utils.each($tw.utils.getOrderedAttributesFromParseTreeNode(this.parseTreeNode),function(attribute) {
|
||||
var name = attribute.name;
|
||||
@ -79,16 +89,6 @@ GenesisWidget.prototype.execute = function() {
|
||||
}
|
||||
$tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],$tw.utils.extend({},attribute,{name: name}));
|
||||
});
|
||||
// Apply attributes in $names/$values
|
||||
this.attributeNames = [];
|
||||
this.attributeValues = [];
|
||||
if(this.genesisNames && this.genesisValues) {
|
||||
this.attributeNames = this.wiki.filterTiddlers(self.genesisNames,this);
|
||||
this.attributeValues = this.wiki.filterTiddlers(self.genesisValues,this);
|
||||
$tw.utils.each(this.attributeNames,function(varname,index) {
|
||||
$tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],varname,self.attributeValues[index] || "");
|
||||
});
|
||||
}
|
||||
// Construct the child widgets
|
||||
this.makeChildWidgets(parseTreeNodes);
|
||||
};
|
||||
|
@ -11,4 +11,4 @@ title: Output
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>(Kitten|Donkey)(Kitten|Donkey)</p>
|
||||
<p>(Shark|Donkey)(Shark|Donkey)</p>
|
@ -25,7 +25,7 @@ The content of the <<.wid genesis>> widget is used as the content of the dynamic
|
||||
|
||||
<<.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.
|
||||
<<.from-version "5.3.6">> Note that attributes explicitly specified take precedence over attributes with the same name specified in the `$names` filter. This has always been the documented behaviour but prior to [[Release 5.3.6]] the implementation was reversed, and the `$names` attributes took precedence. This was fixed in [[Release 5.3.6]].
|
||||
|
||||
! Examples
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user