diff --git a/core/modules/filters/is/variable.js b/core/modules/filters/is/variable.js index 1f2e5d1b3..110d9a7c8 100644 --- a/core/modules/filters/is/variable.js +++ b/core/modules/filters/is/variable.js @@ -19,13 +19,13 @@ exports.variable = function(source,prefix,options) { var results = []; if(prefix === "!") { source(function(tiddler,title) { - if(!(title in options.widget.variables)) { + if(options.widget.getVariable(title) === undefined) { results.push(title); } }); } else { source(function(tiddler,title) { - if(title in options.widget.variables) { + if(options.widget.getVariable(title) !== undefined) { results.push(title); } }); diff --git a/core/modules/filters/variables.js b/core/modules/filters/variables.js index fda40a404..c92b780d2 100644 --- a/core/modules/filters/variables.js +++ b/core/modules/filters/variables.js @@ -16,9 +16,15 @@ Filter operator for returning the names of the active variables Export our filter function */ exports.variables = function(source,operator,options) { - var names = []; - for(var variable in options.widget.variables) { - names.push(variable); + var names = [], + widget = options.widget; + while(widget && !widget.hasOwnProperty("variables")) { + widget = widget.parentWidget; + } + if(widget && widget.variables) { + for(var variable in widget.variables) { + names.push(variable); + } } return names.sort(); };