diff --git a/core/modules/widgets/void.js b/core/modules/widgets/void.js new file mode 100755 index 000000000..e7b982a35 --- /dev/null +++ b/core/modules/widgets/void.js @@ -0,0 +1,49 @@ +/*\ +title: $:/core/modules/widgets/Void.js +type: application/javascript +module-type: widget + +Void widget that is not intended for render. + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var Widget = require("$:/core/modules/widgets/widget.js").widget; + +var VoidNodeWidget = function(parseTreeNode,options) { + this.initialise(parseTreeNode,options); +}; + +/* +Inherit from the base widget class +*/ +VoidNodeWidget.prototype = new Widget(); + +/* +Render this widget into the DOM +*/ +VoidNodeWidget.prototype.render = function(parent,nextSibling) { + // Nothing to do for a void node +}; + +/* +Compute the internal state of the widget +*/ +VoidNodeWidget.prototype.execute = function() { + // Nothing to do for a void node +}; + +/* +Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering +*/ +VoidNodeWidget.prototype.refresh = function(changedTiddlers) { + return false; +}; + +exports.void = VoidNodeWidget; + +})(); diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 73c299d69..6f2842d19 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -554,7 +554,7 @@ Widget.prototype.makeChildWidget = function(parseTreeNode,options) { if(!WidgetClass) { WidgetClass = this.widgetClasses.text; // Skip void node that is not intended for render. Show error for missing widgets. - parseTreeNode = {type: "text", text: parseTreeNode.void ? "" : "Undefined widget '" + parseTreeNode.type + "'"}; + parseTreeNode = {type: "text", text: "Undefined widget '" + parseTreeNode.type + "'"}; } // Create set variable widgets for each variable $tw.utils.each(options.variables,function(value,name) {