mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-25 11:44:52 +00:00
Allow a default value to be specified for WikiRenderTree.getContextVariable
This commit is contained in:
@@ -101,14 +101,14 @@ WikiRenderTree.prototype.refreshInDom = function(changes) {
|
|||||||
/*
|
/*
|
||||||
Find the value of a given context variable for a particular renderer node
|
Find the value of a given context variable for a particular renderer node
|
||||||
*/
|
*/
|
||||||
WikiRenderTree.prototype.getContextVariable = function(renderer,name) {
|
WikiRenderTree.prototype.getContextVariable = function(renderer,name,defaultValue) {
|
||||||
while(renderer) {
|
while(renderer) {
|
||||||
if($tw.utils.hop(renderer.context,name)) {
|
if($tw.utils.hop(renderer.context,name)) {
|
||||||
return renderer.context[name];
|
return renderer.context[name];
|
||||||
}
|
}
|
||||||
renderer = renderer.parentRenderer;
|
renderer = renderer.parentRenderer;
|
||||||
};
|
};
|
||||||
return undefined;
|
return defaultValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user