mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-05-29 16:52:18 +00:00
fix: MVV handling should distinguish between blank and undefined attributes (#9687)
This commit is contained in:
@@ -390,7 +390,7 @@ Widget.prototype.computeAttributes = function(options) {
|
||||
if($tw.utils.isArray(value)) {
|
||||
multiValue = value;
|
||||
newMultiValuedAttributes[name] = multiValue;
|
||||
value = value[0];
|
||||
value = value[0] || "";
|
||||
}
|
||||
var changed = (self.attributes[name] !== value);
|
||||
if(!changed && multiValue && self.multiValuedAttributes) {
|
||||
@@ -452,9 +452,7 @@ Widget.prototype.computeAttribute = function(attribute,options) {
|
||||
} else { // String attribute
|
||||
value = attribute.value;
|
||||
if(options.asList) {
|
||||
if(value === undefined) {
|
||||
value = [];
|
||||
} else {
|
||||
if(value !== undefined) {
|
||||
value = [value];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,6 @@ tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure testproc()
|
||||
This is ''wikitext''
|
||||
\end
|
||||
|
||||
|
||||
<$tiddler tiddler="Data">
|
||||
<$transclude $index="testindex"/>
|
||||
-
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
title: Transclude/MissingTiddlerAttributeFiltered
|
||||
description: Missing Tiddler Attribute Filtered
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
<$transclude tiddler={{{ [[sometiddler]get[nosuchfield]] }}}/>
|
||||
-
|
||||
<$transclude tiddler="">fallback content</$transclude>
|
||||
-
|
||||
<$transclude tiddler={{{ [[sometiddler]get[nosuchfield]] }}}>fallback content</$transclude>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>
|
||||
-
|
||||
fallback content
|
||||
-
|
||||
fallback content</p>
|
||||
Reference in New Issue
Block a user